Showing posts with label values. Show all posts
Showing posts with label values. Show all posts

Thursday, March 29, 2012

pass multiple values from one aspx page to another

I have to pass values from one aspx page to another. The controls I
have in the first page are:
a textbox, 3 drop down lists, and 2 check boxes, and a submit button.
It is a search page, and the users need not enter values in all the
controls. they can leave the textbox blank, and select values from one
drop down, or any other combinations.
I am trying to pass values with the help of session variables. But I
have multiple if else statements like:
if (ddlCategories.SelectedItem.Value == "")
{
Session["CatID"] = "";
}
else
{
Session["CatID"] = ddlCategories.SelectedItem.Value;
}
The value in the second drop down depends on the value in the first,
and the value in the third drop down depends on the second drop down.
So, its giving me an error saying "Object reference not set to an
instance of the object" if I don't select any value from the first drop
down .(same is the case for the second drop down).
What is the best way yo do this? without all the if else statements,
and may be without using the session variables.
any suggestions?Regarding your object reference error...
You could check for the existance of a selected item first, before trying to
read its value, e.g.
Session["CatID"] = "";
if (ddlCategories.SelectedItem != null)
Session["CatID"] = ddlCategories.SelectedItem.Value;
However I think that there may be a shortcut approach using
ddlCategories.SelectedValue instead. I haven't tested this property without
a selected item, but it will probably return null rather than an exception.
Worth exploring. If it works for you, you may be able to simplify the
constructs to, e.g.;
Session["CatID"] = ddlCategories.SelectedItem.Value;
... with no safety check. If you need to treat "" and null the same (and
have "" as values in your list), you can write a helper function as in;
Session["CatID"] = MakeEmptyStringNull (ddlCategories.SelectedItem.Value);
Regarding your value-passing approach, session variables work fine but makes
the receiving page limited. I prefer to put essentially all navigation
rules into the Url so that users can bookmark search pages reliably, forward
the Url to friends, etc. The cleanest way I've found to do this is to
construct a class that manages the navigation to the target page, and
formulates the Url based on properties, e.g.
class SearchPageUrl
{
public string CatID;
public string Option1;
public string Option2;
/// Generate the Url
public override string ToString ()
{
return String.Format (
"/search/results.aspx?CatID={0}&Option1={1}&Option2={2}",
CatID, Option1, Option2
);
}
/// Determine whether the necessary properties have been set to generate
a valid Url
public bool IsValidUrl ()
{
return true;
}
}
in your onclick;
SearchPageUrl sup = new SearchPageUrl ();
sup.CatID = ddlCategories.SelectedValue;
sup.Option1 = ... ;
sup.Option2 = ... ;
if (sup.IsValidUrl())
Response.Redirect (sup.ToString ());
else
// show error
In your receiving page, you can simplify the querystring processing through
page-level properties, e.g.;
private bool HasCatID
{
get { return Request["CatID"] != null; }
}
private int CatID
{
get { return Int32.Parse (Request["CatID"]); }
}
Which keeps the code in your page clean, and centralizes the parsing of your
querystring propeties.
Clearly this is a bit more code than the Session var approach but it's worth
considering. Most users expect the pages to be bookmarkable.
/// M
"macyp" <vradhika@.gmail.com> wrote in message
news:1106755384.274484.211140@.c13g2000cwb.googlegroups.com...
> I have to pass values from one aspx page to another. The controls I
> have in the first page are:
> a textbox, 3 drop down lists, and 2 check boxes, and a submit button.
> It is a search page, and the users need not enter values in all the
> controls. they can leave the textbox blank, and select values from one
> drop down, or any other combinations.
> I am trying to pass values with the help of session variables. But I
> have multiple if else statements like:
> if (ddlCategories.SelectedItem.Value == "")
> {
> Session["CatID"] = "";
> }
> else
> {
> Session["CatID"] = ddlCategories.SelectedItem.Value;
> }
> The value in the second drop down depends on the value in the first,
> and the value in the third drop down depends on the second drop down.
> So, its giving me an error saying "Object reference not set to an
> instance of the object" if I don't select any value from the first drop
> down .(same is the case for the second drop down).
> What is the best way yo do this? without all the if else statements,
> and may be without using the session variables.
> any suggestions?
>
Hi Macyp,
Checking that the SelectedIndex DropDownList property is not equal to
-1 before retrieving the SelectedItem.Value property should solve your
"Object referenct" problem. Sample:
if (ddlCategories.SelectedIndex != -1)
Tod Birdsall
http://tod1d.blogspot.com

pass multiple values from one aspx page to another

I have to pass values from one aspx page to another. The controls I
have in the first page are:
a textbox, 3 drop down lists, and 2 check boxes, and a submit button.
It is a search page, and the users need not enter values in all the
controls. they can leave the textbox blank, and select values from one
drop down, or any other combinations.
I am trying to pass values with the help of session variables. But I
have multiple if else statements like:

if (ddlCategories.SelectedItem.Value == "")
{
Session["CatID"] = "";
}
else
{
Session["CatID"] = ddlCategories.SelectedItem.Value;
}

The value in the second drop down depends on the value in the first,
and the value in the third drop down depends on the second drop down.
So, its giving me an error saying "Object reference not set to an
instance of the object" if I don't select any value from the first drop
down .(same is the case for the second drop down).

What is the best way yo do this? without all the if else statements,
and may be without using the session variables.
any suggestions?Regarding your object reference error...

You could check for the existance of a selected item first, before trying to
read its value, e.g.

Session["CatID"] = "";
if (ddlCategories.SelectedItem != null)
Session["CatID"] = ddlCategories.SelectedItem.Value;

However I think that there may be a shortcut approach using
ddlCategories.SelectedValue instead. I haven't tested this property without
a selected item, but it will probably return null rather than an exception.
Worth exploring. If it works for you, you may be able to simplify the
constructs to, e.g.;

Session["CatID"] = ddlCategories.SelectedItem.Value;

... with no safety check. If you need to treat "" and null the same (and
have "" as values in your list), you can write a helper function as in;

Session["CatID"] = MakeEmptyStringNull (ddlCategories.SelectedItem.Value);

Regarding your value-passing approach, session variables work fine but makes
the receiving page limited. I prefer to put essentially all navigation
rules into the Url so that users can bookmark search pages reliably, forward
the Url to friends, etc. The cleanest way I've found to do this is to
construct a class that manages the navigation to the target page, and
formulates the Url based on properties, e.g.

class SearchPageUrl
{
public string CatID;
public string Option1;
public string Option2;

/// Generate the Url
public override string ToString ()
{
return String.Format (
"/search/results.aspx?CatID={0}&Option1={1}&Option2={2}",
CatID, Option1, Option2
);
}

/// Determine whether the necessary properties have been set to generate
a valid Url
public bool IsValidUrl ()
{
return true;
}
}

in your onclick;

SearchPageUrl sup = new SearchPageUrl ();
sup.CatID = ddlCategories.SelectedValue;
sup.Option1 = ... ;
sup.Option2 = ... ;

if (sup.IsValidUrl())
Response.Redirect (sup.ToString ());
else
// show error

In your receiving page, you can simplify the querystring processing through
page-level properties, e.g.;

private bool HasCatID
{
get { return Request["CatID"] != null; }
}
private int CatID
{
get { return Int32.Parse (Request["CatID"]); }
}

Which keeps the code in your page clean, and centralizes the parsing of your
querystring propeties.

Clearly this is a bit more code than the Session var approach but it's worth
considering. Most users expect the pages to be bookmarkable.

/// M

"macyp" <vradhika@.gmail.com> wrote in message
news:1106755384.274484.211140@.c13g2000cwb.googlegr oups.com...
> I have to pass values from one aspx page to another. The controls I
> have in the first page are:
> a textbox, 3 drop down lists, and 2 check boxes, and a submit button.
> It is a search page, and the users need not enter values in all the
> controls. they can leave the textbox blank, and select values from one
> drop down, or any other combinations.
> I am trying to pass values with the help of session variables. But I
> have multiple if else statements like:
> if (ddlCategories.SelectedItem.Value == "")
> {
> Session["CatID"] = "";
> }
> else
> {
> Session["CatID"] = ddlCategories.SelectedItem.Value;
> }
> The value in the second drop down depends on the value in the first,
> and the value in the third drop down depends on the second drop down.
> So, its giving me an error saying "Object reference not set to an
> instance of the object" if I don't select any value from the first drop
> down .(same is the case for the second drop down).
> What is the best way yo do this? without all the if else statements,
> and may be without using the session variables.
> any suggestions?
Hi Macyp,

Checking that the SelectedIndex DropDownList property is not equal to
-1 before retrieving the SelectedItem.Value property should solve your
"Object referenct" problem. Sample:

if (ddlCategories.SelectedIndex != -1)
Tod Birdsall
http://tod1d.blogspot.com

pass null values

I have a web form that allows a user to do a search, they can select all the
parameters on the web form or only select a few. If the user does not select
a value to search on, how can I pass that to stored procedure and get data
back?
example form:
the user can search on
first name
last name
hire date
termination date
if they only know the first and last name, how can i get data back if the
dates are not entered?see DBNull class
-- bruce (sqlwork.com)
"NuB" <me@.me.com> wrote in message
news:Od3vppMAGHA.2788@.TK2MSFTNGP14.phx.gbl...
>I have a web form that allows a user to do a search, they can select all
>the parameters on the web form or only select a few. If the user does not
>select a value to search on, how can I pass that to stored procedure and
>get data back?
> example form:
> the user can search on
> first name
> last name
> hire date
> termination date
> if they only know the first and last name, how can i get data back if the
> dates are not entered?
>
>

pass several parameters

Hello,

I am new with asp.net and I have some basic questions:

1What's the normal way of passing several server objets )(asp:text...)values to another page, when I click in a submit button.
(the same that we were doing in asp with the post.

2.I have a page where I have to do a search of the data of a peron by Id.
When the user click in the search button after givint the id, dO I have to bind each server control (in this case 5 <asp: testbox..>, name, surname, address, age, date birth) to the result of the query to retrieve the data?
How do I do that if my result is in a only query?

ThanksSee if below Link coule helps you. Seems you also have to do same kind of business ligic.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconPassingServerControlValuesBetweenPages.asp

Monday, March 26, 2012

Pass the values to the sub..

I am not sure how to pass the value to use another sub..

i want to pass these two value to another sub(passvalue ())..

Sub page_load(source as object, E as eventArgs)
strvalue1="value1"
strvalue2="value2"

passvalue()

end sub

sub passvalue()

xxxxxxxxx
end sub


Sub page_load(source as object, E as eventArgs)
strvalue1="value1"
strvalue2="value2"

passvalue(strvalue1, strvalue2)

end sub

sub passvalue(byval arg1 as string, byval arg2 as string, etc...)
xxxxxxxxx
end sub

Pass two values in querystring

I am trying to pass two values in a querystring. I have no problem passing one but when I try to pass two the second doesn't work.

Heres an example of what I'm doing:

Response.Redirect(passingpage.aspx&value={0}&value2=" & txtvalue2.Text)

The first value is from a hyperlink column of a datagrid which works fine by itself. When I try to pass the second value from a textbox, it doesn't work. I'm using visual basic.

Can anyone help?the first parameter is denoted by a ? and the subsequent ones a &

eg

http:www.costall.com/default.aspx?param1=hello&Param2=world

does this answer the question or is it a typo in the post?
I have tried that and it doesn't work. Any other suggestions?
can you post the code sample?
Hello, try this:

Dim url As String = "passingpage.aspx?value1=" & txtValue1.Text & "&value2=" & txtValue2.Text
Response.Redirect(url)

regards

Pass values

I have the following Stored procedure. There is column named
"tcktreceived" in my database and I want to pass all the rows one by
one to the parameter @dotnet.itags.org.starttime. I don't know how to do it.

CREATE PROCEDURE [twcsan].[usp_DateDiff]
-- Add the parameters for the stored procedure here
@dotnet.itags.org.starttime DateTime

AS
BEGIN
DECLARE @dotnet.itags.org.Diff Varchar(15)
DECLARE @dotnet.itags.org.Day INT
DECLARE @dotnet.itags.org.Hour INT
DECLARE @dotnet.itags.org.Minute INT
DECLARE @dotnet.itags.org.Start_Date DateTime
DECLARE @dotnet.itags.org.End_Date DateTime
DECLARE @dotnet.itags.org.itemReceived DateTime
DECLARE @dotnet.itags.org.ID INT
DECLARE @dotnet.itags.org.message VARCHAR(50)

DECLARE @dotnet.itags.org.table TABLE
(
ItemReceived DateTime,
ID INT,
message text,
Differnce VARCHAR(20)

)
SET NOCOUNT ON;
SET @dotnet.itags.org.Start_Date = @dotnet.itags.org.starttime

SET @dotnet.itags.org.End_Date = GETDATE()
SET @dotnet.itags.org.Day = DATEDIFF( day, @dotnet.itags.org.Start_Date, @dotnet.itags.org.End_Date)
SET @dotnet.itags.org.Hour = DATEDIFF(hour , @dotnet.itags.org.Start_Date, @dotnet.itags.org.End_Date)
SET @dotnet.itags.org.Minute = DATEDIFF(minute , @dotnet.itags.org.Start_Date, @dotnet.itags.org.End_Date)
SET @dotnet.itags.org.Minute = @dotnet.itags.org.Minute-(@dotnet.itags.org.HOUR* 60)
SET @dotnet.itags.org.Hour = @dotnet.itags.org.Hour-(24* @dotnet.itags.org.Day)
SET @dotnet.itags.org.Diff = CONVERT(Varchar, @dotnet.itags.org.Day) +'d ' + CONVERT(Varchar , @dotnet.itags.org.Hour) +
'h ' + CONVERT(Varchar , @dotnet.itags.org.Minute) +'m'

INSERT INTO @dotnet.itags.org.table(ItemReceived, ID, message, Differnce)
select tck.tcktreceived, tck.ticketid,tckmsg.tcktmessage,@dotnet.itags.org.Diff
from tbtickets tck inner join tbticketsmessages tckmsg
on tck.ticketid = tckmsg.ticketid

select * from @dotnet.itags.org.table

ENDI'm not sure what your after, but try looking at using "Cursor" that might
give you what you need.

Pass values

Hi,
How to pass values from one to another page using post method? And how to retrieve them at another page?

ASP.NET uses by default POST method, so what is your question?

Regards


You can use a querystring through the URL, the session object, application object, Server.Transfer().

Depending on what you need, those are a few of the ways to maintain state off the top of my head.
In old asp 3.0. I'd use something like <form action="page2.asp"...>
Then In page two I'd use request to retrieve values.
How to achieve this with asp.net?

"In old asp 3.0. I'd use something like <form action="page2.asp"...>
Then In page two I'd use request to retrieve values."
In .Net you don't post do a different page, by default it post's back to itself. All web controls that have viewstate enabled will have their values stored during the postback and be accessable when the page post backs to itself.
Perhaps if you give us a specific example of what you're trying to accomplish it'd be a bit easier to help you specifically where you need it?
Lets say I want to have simple search funcionality. Search string whentyped in any page, should be passed to results.aspx page. There shouldexact searchs occur and results be displayed.
So...?

In c# code you should do something like this:

Response.Redirect("Results.aspx?searchString="+searchBox.Text+); //put a parameter in the redirect page

Note that the "searchString" is the name of the parameter you areadding to the redirect, you can call it whatever you want. ThesearchBox.Text is the TextBox of search.

Now in the page you've redirected, you will extract the parameter

string textSearch = Response.QueryString["searchString"];

Now that I'm here, how did you develop your search engine?Do you checkevery table in your database and return every values that match thesearch?If you have news, studies in your database you show for examplenews and then the news related, and then the studies and then therelated studies for example?

Thanks, hope I did help!

Hi,

If you have html page with search form, for example, you can add <form action="Result.aspx" type="post"> in it then you can get all post variables using Request.Form[variableName]. In case you use form as aspx page you do not need to transfer to other page - you can and should process all events (buttons clicks etc) right in this page. It's common for asp.net and it's recommend to use this technique.

But if you need to transfer post data to other aspx page you can use Server.Transfer() method in, for instance, button click event. Then you can get all post variables including controls state from previous aspx page using Request.Form.

In asp.net 2 you can also use cross page postback (read more about it therehttp://msdn2.microsoft.com/en-us/library/ms178139(vs.80).aspx).


I'm have the same problem. How can I get the Query String in VB?

do server.transfer.

Let me give you an example.

-- default page --<form runat="server"> ... <asp:textbox id="text1" runat="server" text="value1here"/> <asp:textbox id="text2" runat="server" text="value2here"/> ... <asp:button id="btn1" runat="server" text="button1"/> <asp:button id="btn2" runat="server" text="button2"/> ...</form>-- this is the btn1 onclick behavior you want to go page1.aspx right? --Protected Sub btn1_Click(ByVal senderAs Object,ByVal eAs System.EventArgs)Handles btn1.Click server.transfer("page1.aspx", true)end sub-- this is the way to show text1 at page1.aspx --Protected Sub Page_Load(ByVal senderAs Object,ByVal eAs System.EventArgs)Handles Me.Load label1.text = request.form("text1")end sub

that's it. you can pass the values within http request, because when you click buttons, the values gets saved to http request via postback. alll you are doing is passing values in http request in next page. form submission is done for you automatically.

improvise and you'll succeed.

Hope this helps and let me know what happens.

Jae.


Great but what if iis in a datalist? I can't get the value out.

you can declare a hidden field:

 <asp:DataList ID="datalist1" runat="Server"> <ItemTemplate> <asp:HiddenField ID="hidden" Value='<%#eval("valuetopass")%>'> </ItemTemplate> </asp:DataList>

user server.transfer afterwards then retrieve value by:

request.form("hidden")
Hope this helps.
Jae.

If you are using .NET 2.0, you can set the postBackURL on the form. This will allow your page to directly post to your new page.

Nick


Do you know how to do this in VB.net?

Sorry, I got it

Request.QueryString(

"Variable")

Thanks for the help.Big Smile

Pass values

I have the following Stored procedure. There is column named
"tcktreceived" in my database and I want to pass all the rows one by
one to the parameter @dotnet.itags.org.starttime. I don't know how to do it.
CREATE PROCEDURE [twcsan].[usp_DateDiff]
-- Add the parameters for the stored procedure here
@dotnet.itags.org.starttime DateTime
AS
BEGIN
DECLARE @dotnet.itags.org.Diff Varchar(15)
DECLARE @dotnet.itags.org.Day INT
DECLARE @dotnet.itags.org.Hour INT
DECLARE @dotnet.itags.org.Minute INT
DECLARE @dotnet.itags.org.Start_Date DateTime
DECLARE @dotnet.itags.org.End_Date DateTime
DECLARE @dotnet.itags.org.itemReceived DateTime
DECLARE @dotnet.itags.org.ID INT
DECLARE @dotnet.itags.org.message VARCHAR(50)
DECLARE @dotnet.itags.org.table TABLE
(
ItemReceived DateTime,
ID INT,
message text,
Differnce VARCHAR(20)
)
SET NOCOUNT ON;
SET @dotnet.itags.org.Start_Date = @dotnet.itags.org.starttime
SET @dotnet.itags.org.End_Date = GETDATE()
SET @dotnet.itags.org.Day = DATEDIFF( day, @dotnet.itags.org.Start_Date, @dotnet.itags.org.End_Date)
SET @dotnet.itags.org.Hour = DATEDIFF(hour , @dotnet.itags.org.Start_Date, @dotnet.itags.org.End_Date)
SET @dotnet.itags.org.Minute = DATEDIFF(minute , @dotnet.itags.org.Start_Date, @dotnet.itags.org.End_Date)
SET @dotnet.itags.org.Minute = @dotnet.itags.org.Minute-(@dotnet.itags.org.HOUR* 60)
SET @dotnet.itags.org.Hour = @dotnet.itags.org.Hour-(24* @dotnet.itags.org.Day)
SET @dotnet.itags.org.Diff = CONVERT(Varchar, @dotnet.itags.org.Day) +'d ' + CONVERT(Varchar , @dotnet.itags.org.Hour) +
'h ' + CONVERT(Varchar , @dotnet.itags.org.Minute) +'m'
INSERT INTO @dotnet.itags.org.table(ItemReceived, ID, message, Differnce)
select tck.tcktreceived, tck.ticketid,tckmsg.tcktmessage,@dotnet.itags.org.Diff
from tbtickets tck inner join tbticketsmessages tckmsg
on tck.ticketid = tckmsg.ticketid
select * from @dotnet.itags.org.table
ENDI'm not sure what your after, but try looking at using "Cursor" that might
give you what you need.

pass values

On my web page i'm passing in a value using request.querystring, but i need
this same value several other pages. How can I store this value and use it o
n my other pages to execute my SQL?
thxIn a session variable.
Eliyahu
"IGotYourDotNet" <IGotYourDotNet@.discussions.microsoft.com> wrote in message
news:C3EEF090-CC7C-4A13-83EF-C0D7A655B93E@.microsoft.com...
> On my web page i'm passing in a value using request.querystring, but i
need this same value several other pages. How can I store this value and use
it on my other pages to execute my SQL?
> thx
You say you're "passing in a value" - Where are you passing it from? Where
are you passing it to?
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
"IGotYourDotNet" <IGotYourDotNet@.discussions.microsoft.com> wrote in message
news:C3EEF090-CC7C-4A13-83EF-C0D7A655B93E@.microsoft.com...
> On my web page i'm passing in a value using request.querystring, but i
need this same value several other pages. How can I store this value and use
it on my other pages to execute my SQL?
> thx
You can pass values between pages using a variety of methods - session
variables are common, as is using viewstate. I prefer to structure my code
really well and use properties via the refernce page directive. Theres a
small example below for you
Regards
John Timney
Microsoft Regional Director
Microsoft MVP
"IGotYourDotNet" <IGotYourDotNet@.discussions.microsoft.com> wrote in message
news:C3EEF090-CC7C-4A13-83EF-C0D7A655B93E@.microsoft.com...
> On my web page i'm passing in a value using request.querystring, but i
need this same value several other pages. How can I store this value and use
it on my other pages to execute my SQL?
> thx
PassingValuesPage.aspx
<%@. Page Language="VB" ClassName="FirstPageClass" %>
<html>
<head>
<script runat="server">
Public ReadOnly Property FirstName() As String
Get
' first is the name of a TextBox control.
Return first.Text
End Get
End Property
Public ReadOnly Property LastName() As String
Get
' last is the name of a TextBox control.
Return last.Text
End Get
End Property
Sub ButtonClicked(sender As Object, e As EventArgs)
Server.Transfer("ReceivingValuesPage.aspx")
End Sub
</script>
</head>
<body>
<form runat="server">
First Name:
<asp:TextBox id="first"
runat="server"/>
<br>
Last Name:
<asp:TextBox id="last"
runat="server"/>
<br>
<asp:Button
OnClick="ButtonClicked"
Text="Go to second page"
runat=server />
</form>
</body>
</html>
--recievingvalues.aspx
<%@. Page Language="VB" %>
<%@. Reference Page="passingValuesPage.aspx" %>
<html>
<head>
<script runat="server">
Dim fp As FirstPageClass
Sub Page_Load()
If Not IsPostBack Then
fp = CType(Context.Handler, FirstPageClass)
End If
End Sub
</script>
</head>
<body>
<form runat="server">
Hello <%=fp.FirstName%> <%=fp.LastName%>
</form>
</body>
</html>

Pass values between 2 asp.net applications

I have two asp.net web applications.
The 1st appn has a login page and the other appln has other pages.
When the user logs from 1st appln, i want to pass the username to be passed to the other application.
I do not want to pass through query string.
Is there other way out. Please help!!!!!!!!!

SaifIs there a reason why they are in seperate apps?

However, to solve the problem you could try using a Cookie.

pass values back to parent window

I want to open up a little window so the user can choose something. So I wil
l
use javascript window.open to open up another aspx. However when they close
this i want to map some text box values on this page to some text box values
on the parent aspx. I have no idea how i would do this. any ideas? thank you
.hi louise,
u need to use window.opener function of javascript, chk this link for more
details :
http://www.vbcity.com/forums/topic...window%2Eopener
"louise raisbeck" <louiseraisbeck@.discussions.microsoft.com> wrote in
message news:DF3969DD-0E61-47D3-8A76-B2D59CDDC474@.microsoft.com...
> I want to open up a little window so the user can choose something. So I
will
> use javascript window.open to open up another aspx. However when they
close
> this i want to map some text box values on this page to some text box
values
> on the parent aspx. I have no idea how i would do this. any ideas? thank
you.
very helpful. thank you.
"parshuram" wrote:

> hi louise,
> u need to use window.opener function of javascript, chk this link for more
> details :
> http://www.vbcity.com/forums/topic...window%2Eopener
> "louise raisbeck" <louiseraisbeck@.discussions.microsoft.com> wrote in
> message news:DF3969DD-0E61-47D3-8A76-B2D59CDDC474@.microsoft.com...
> will
> close
> values
> you.
>
>

pass values back to parent window

I want to open up a little window so the user can choose something. So I will
use javascript window.open to open up another aspx. However when they close
this i want to map some text box values on this page to some text box values
on the parent aspx. I have no idea how i would do this. any ideas? thank you.hi louise,

u need to use window.opener function of javascript, chk this link for more
details :

http://www.vbcity.com/forums/topic...window%2Eopener

"louise raisbeck" <louiseraisbeck@.discussions.microsoft.com> wrote in
message news:DF3969DD-0E61-47D3-8A76-B2D59CDDC474@.microsoft.com...
> I want to open up a little window so the user can choose something. So I
will
> use javascript window.open to open up another aspx. However when they
close
> this i want to map some text box values on this page to some text box
values
> on the parent aspx. I have no idea how i would do this. any ideas? thank
you.
very helpful. thank you.

"parshuram" wrote:

> hi louise,
> u need to use window.opener function of javascript, chk this link for more
> details :
> http://www.vbcity.com/forums/topic...window%2Eopener
> "louise raisbeck" <louiseraisbeck@.discussions.microsoft.com> wrote in
> message news:DF3969DD-0E61-47D3-8A76-B2D59CDDC474@.microsoft.com...
> > I want to open up a little window so the user can choose something. So I
> will
> > use javascript window.open to open up another aspx. However when they
> close
> > this i want to map some text box values on this page to some text box
> values
> > on the parent aspx. I have no idea how i would do this. any ideas? thank
> you.
>

Pass values in QueryString using VB.Net

Response.Redirect("http://localhost/WebApplication3/Forms/paymentprocessing.aspx?fname=+"

'Me.txtFirstName.Text"'", False)

how do i pass the text from a control in the querey string???

Dim myURL as string = "http://Localhost/WebApplication3/Forms/paymentprocessing.aspx?fname="

myURL = myURL & Me.txtFirstName.Text

Response.Redirect(myURL, False)

Pass values from URL to other pages ?

i have a page A and Page B.
in Page A have 2 links to Page B. to display a set of date based on
condiction set in url.. like
in page A
link1 = pageB.aspx?id=1
link2 = pageB.aspx?id=2
so when page B opens it sould get the values from the url and run a queary..
like
SELECT * FROM TABEL WHERE KEY_ID= (value got some page A)
in page B i have a Dataview bind with 'SqlDataSource' i exactly dont know to
call the valus from URL...
your thoughs much appericated !Hi ,
You can get value from Url by using Request.Querystring["id"].
Thanks
Sharmila
You can use the QueryString property of the Request: Request.QueryString["id
"].
See
[url]http://authors.aspalliance.com/aspxtreme/sys/web/httprequestclassquerystring.aspx[
/url]
Hege Servold
hege.servold(AT)bekk.no
"velu" wrote:

> i have a page A and Page B.
> in Page A have 2 links to Page B. to display a set of date based on
> condiction set in url.. like
> in page A
> link1 = pageB.aspx?id=1
> link2 = pageB.aspx?id=2
> so when page B opens it sould get the values from the url and run a queary
.
> like
> SELECT * FROM TABEL WHERE KEY_ID= (value got some page A)
> in page B i have a Dataview bind with 'SqlDataSource' i exactly dont know
to
> call the valus from URL...
> your thoughs much appericated !

Pass values from URL to other pages ?

i have a page A and Page B.

in Page A have 2 links to Page B. to display a set of date based on
condiction set in url.. like

in page A

link1 = pageB.aspx?id=1
link2 = pageB.aspx?id=2

so when page B opens it sould get the values from the url and run a queary..

like

SELECT * FROM TABEL WHERE KEY_ID= (value got some page A)

in page B i have a Dataview bind with 'SqlDataSource' i exactly dont know to
call the valus from URL...

your thoughs much appericated !Hi ,

You can get value from Url by using Request.Querystring["id"].

Thanks
Sharmila
You can use the QueryString property of the Request: Request.QueryString["id"].
See
http://authors.aspalliance.com/aspx...uerystring.aspx

--
Hege Servold
hege.servold(AT)bekk.no

"velu" wrote:

> i have a page A and Page B.
> in Page A have 2 links to Page B. to display a set of date based on
> condiction set in url.. like
> in page A
> link1 = pageB.aspx?id=1
> link2 = pageB.aspx?id=2
> so when page B opens it sould get the values from the url and run a queary..
> like
> SELECT * FROM TABEL WHERE KEY_ID= (value got some page A)
> in page B i have a Dataview bind with 'SqlDataSource' i exactly dont know to
> call the valus from URL...
> your thoughs much appericated !

Pass values from one user control to a user control on a different aspx page

Hello,

I have an aspx page titled Search.aspx. Within this page, I have a user control titled Search.ascx. I want a user to input search terms, then on the click of a button, I want to pass the values to another page (SearchResults.aspx)...which will then display the results in a user control.

Can someone please give me some suggestions on how to do this?

Thanks a lot!Hello, what you can do is:

inside ur usercontrol, create a method that returns a dataset or datareader. that is, since u are searching using the usercontrol, then the result of ur search will be returned by a method of type either dataset or datareader.

and in ur code-behind of the aspx page u can use it as follows:

protected Myusercontrol user;
private DataSet ds = user.GetResults();

and then u might want to put it in a session variable or xml file and then u will be able to access it from the SearchResults.aspx

but why do u want to show results in another page ?

Pass Values to another page.

I am trying to a create a page that will query a SQLDB get customer
information and then pass this information on to another page creating
almost like a mail merge letter. I can get the information no problem using
a repeater but how do I pass <%#container.DataItem("Value1")%> to another
page.

Thx.Hi

Put information you want to share between pages either in
Session Object or Cache Object.

Ravikanth

>--Original Message--
>I am trying to a create a page that will query a SQLDB
get customer
>information and then pass this information on to another
page creating
>almost like a mail merge letter. I can get the
information no problem using
>a repeater but how do I pass <%#container.DataItem
("Value1")%> to another
>page.
>Thx.
>
>.
Can u give me an example of this?

"Ravikanth[MVP]" <dvravikanth@.hotmail.com> wrote in message
news:015f01c351fa$14740ed0$a101280a@.phx.gbl...
> Hi
> Put information you want to share between pages either in
> Session Object or Cache Object.
> Ravikanth
>
> >--Original Message--
> >I am trying to a create a page that will query a SQLDB
> get customer
> >information and then pass this information on to another
> page creating
> >almost like a mail merge letter. I can get the
> information no problem using
> >a repeater but how do I pass <%#container.DataItem
> ("Value1")%> to another
> >page.
> >Thx.
> >.

Saturday, March 24, 2012

Pass values to .ascx

Hi,

Simple question really, how do i pass values to a .ascx file from .aspx file in c#?

ThanksYou can set property values from your ASPX code.

This site has ALL in the info you'll need, I just found it myself the other day.

Mastering Page-UserControl Communication
I tried this once with a page with a tabstrip + multipage setup. Each tab contained it's own ascx file.

I never got it to work the way I thought that it should. Check this newsgroup thread of mine to see if it applies to you:

http://msdn.microsoft.com/newsgroups/default.aspx?pg=35&lang=en&cr=US&guid=&sloc=en-us&dg=microsoft.public.dotnet.framework.aspnet.webcontrols&fltr=
I came accross the following code that solved my problem, might help others also.


in myuc.aspx
----------
<%-- declare any namespaces --%>
<%@. Register Tagprefix="Channel" Tagname="Title" src="http://pics.10026.com/?src=myuc.ascx"%>
<Channel:Title MyTitle="ABC" /
In myuc.ascx
----------
<script language="C#" runat="server">
public String MyTitle ="Not Set";
void Page_Load(Object Sender, EventArgs e)
{
if (Page.IsPostBack == false)
{
DisplayTitle.Text = MyTitle.ToString();
}
}
</Script>
<asp:Label id="DisplayTitle" runat="server" />

Check out the MSDN article by Scott Mitchell: An extensive Examination of User Controls

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/usercontrols.asp
Hello, you might check :An Extensive Examination of UserControls

regards

pass values of combo box to asp code

I have a combo box and i want to pass its values to open a connection.

To extract values from combo box my freind suggessted me to use Request.querystring("comboname")

but this could be used only when i pass values to the url.

is there any other way to extract the value from combo box

You are right Request.QueryString would be used when you want to get a value from URL. To use your combobox value use DropDownList1.SelectedItem.Text (to get a text) orDropDownList1.SelectedItem.Value (to get value).

Cheers
Ritesh


In addition to the above approach, if you are posting the form then the value of drop down list can be accessed by Request.form("NameofControl"), convert the values as per your requirement.