Thursday, March 29, 2012

Pass information through URL

Hi Guys,

I am trying to pass information through a URL. I have seen a VB example like

<a href="http://links.10026.com/?link=details.aspx?id={0}", Container.DataItem("EmployeeID"

Is the {0} supposed to be a placeholder or something?

Then in C#, i tried to just go something like

<a href='details.aspx?id=<%#DataBinder.Eval(Container.DataItem, "author_ID") %>'><%#DataBinder.Eval(Container.DataItem, "au_lname")%></a><br /
And it works like it should..

Does anyone have a reference of how to properly pass variables through a URL like this?
Or.. what is the proper name of this?

ThanksI am not sure exactly what you are looking for. This is the most basic way of passing variables to a web page. It is based on the GET method which appends the variable id and value to the URL string. There are a number of security issues with this method, as the variable values in plain text and viewable to the user and the amount of data that can be sent is restricted by the maximum allowed length of the URL string, usually 256 chars. However it's simplicity usually makes it useable in some situations.

The other method to pass variables to a web page is through the POST method. This is more secure and more information can be passed.
Hmm.. well thanks for the security warning but, still how would you do this? Security is not an issue at this point for this.

With C#, are you supposed to use a ?id={0} thing, or just skip the {0}, what is that even doing in VB.NET?

Thanks
Oh I see what you are asking now. Basically there is no correct way to build up the URL string, you can concatenate strings or even use a StringBuilder. As long as you build a URL string that is valid.

In the VB example the {0} is indeed a place holder that is replaced by the variable positioned after the ",". In your case the value of Container.DataItem("EmployeeID" ).

In C# I think you can use the {0} thing as well or you could use any of the other string concatenation symbols like the overloaded + operator.

A valid URL string is of the form:
[the URL] ie the webpage that you want to go to
? this indicates that GET variables are about to follow
name1 the name of the first variable
= equals
value1 the value of the first variable
& indicates the start of another variable
name2
=
value2

and so on.
Ah.. thanks

Is there some advantage in using the {0} over just leaving it out?

Pass information from XML file to ASPX page

Hello,
I have an XML file, which contains let's say a <A> tag with a "AProp"
property. I want to manipulate this XML file so that the value of the
AProp property can be passed to the code-behind class (let's say
code.aspx.cs) of another ASPX page. How can I accomplish that?
Thanks in advance for help,
uservoidHi evangelous,
Maybe this can help you:
http://www.planet-source-code.com/v...gWId=10

Guillermo G.
----
--
Guillermo Gonzlez Arroyave :: MCP ASP.Net C# :: DCE4
<evangelous@.gmail.com> wrote in message news:1122017876.519551.161420@.g49g20
00cwa.googlegroups.com...
Hello,
I have an XML file, which contains let's say a <A> tag with a "AProp"
property. I want to manipulate this XML file so that the value of the
AProp property can be passed to the code-behind class (let's say
code.aspx.cs) of another ASPX page. How can I accomplish that?
Thanks in advance for help,
uservoid

Pass information from XML file to ASPX page

Hello,

I have an XML file, which contains let's say a <A> tag with a "AProp"
property. I want to manipulate this XML file so that the value of the
AProp property can be passed to the code-behind class (let's say
code.aspx.cs) of another ASPX page. How can I accomplish that?

Thanks in advance for help,
uservoidHi evangelous,

Maybe this can help you:
http://www.planet-source-code.com/v...=3753&lngWId=10

Guillermo G.

------------------------
Guillermo Gonzlez Arroyave :: MCP ASP.Net C# :: DCE4

<evangelous@.gmail.com> wrote in message news:1122017876.519551.161420@.g49g2000cwa.googlegr oups.com...
Hello,

I have an XML file, which contains let's say a <A> tag with a "AProp"
property. I want to manipulate this XML file so that the value of the
AProp property can be passed to the code-behind class (let's say
code.aspx.cs) of another ASPX page. How can I accomplish that?

Thanks in advance for help,
uservoid

pass javascript object reference to a session object

How can I pass a javascript object reference
var win1 = window.open( ...)
to a Session object
Session["obj1"] =
in a .aspx pageIt is not possible.
Session objects are stored on the server. Client objects are storied on the
client. You can only send text-data. Keep a window open that will hold your
references if you need to.
-- Alex
"mg" wrote:

> How can I pass a javascript object reference
> var win1 = window.open( ...)
> to a Session object
> Session["obj1"] =
> in a .aspx page
Could you be more specific?
Thanks.
"Alex Papadimoulis" wrote:
> It is not possible.
> Session objects are stored on the server. Client objects are storied on th
e
> client. You can only send text-data. Keep a window open that will hold you
r
> references if you need to.
> -- Alex
> "mg" wrote:
>
You cannot pass a window object to the Session object. If you provide more
information about what you are trying to do, someone might be able to help
you better.
Girish Bharadwaj
http://msmvps.com/gbvb
"mg" <mg@.discussions.microsoft.com> wrote in message
news:BA28CC96-461E-41F5-8AE8-06DE179F1CD4@.microsoft.com...
> Could you be more specific?
> Thanks.
> "Alex Papadimoulis" wrote:
>
the
your
What exactly fo you want to do..
Explain maybe i can HELP!
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!

Pass Listitem between Listboxes

I have two listboxes. The first listbox is prepopulated with the selections
that the user has. The "Value" of the items is NOT the same as the "Text".
The user can select an item (or items) from one listbox and move it to the
other listbox. The code for it is:
Dim x, deleted As Integer
For x = 0 To lboxFrom.Items.Count - 1
If lboxFrom.Items.Item(x - deleted).Selected Then
lboxTo.Items.Add(lboxFrom.Items.Item(x - deleted))
lboxFrom.Items.Remove(lboxFrom.Items.Item(x - deleted))
deleted += 1
End If
Next
I have also tried:
Dim x, deleted As Integer
For x = 0 To lboxFrom.Items.Count - 1
If lboxFrom.Items.Item(x - deleted).Selected Then
Dim newItem As New ListItem()
newItem.Text = lboxFrom.Items.Item(x - deleted).Text
newItem.Value = lboxFrom.Items.Item(x - deleted).Value
lboxTo.Items.Add(newItem)
lboxFrom.Items.Remove(lboxFrom.Items.Item(x - deleted))
deleted += 1
End If
Next
The item that passes to the second listbox should have value of the first
listbox item and also the text of the first listbox item. My problem is tha
t
the value and the text of the item placed in the second listbox end up the
same and equal the text of the item in the first listbox. Why is it doing
this and what can I do to get the value for the item from the first listbox
to pass as the value for the item in the second listbox?
Thanks.Hi,
Your code seems fine. Try debugging it, specifically the second way and
place a breakpoint on

> newItem.Text = lboxFrom.Items.Item(x - deleted).Text
then step into until you see what are the runtime values of
lboxFrom.Items.Item(x - deleted).Text and lboxFrom.Items.Item(x -
deleted).Value
I tested (in C# though) with the following handler of the button click:
protected void b1_Click(object s, EventArgs e)
{
System.Web.UI.WebControls.ListItem li;
int i = 0;
while(i < lboxFrom.Items.Count)
{
if(lboxFrom.Items[i].Selected)
{
li = new System.Web.UI.WebControls.ListItem(
lboxFrom.Items[i].Text, lboxFrom.Items[i].Value);
lboxTo.Items.Add(li);
lboxFrom.Items.RemoveAt(i);
continue;
}
i++;
}
}
and the new items in the "To" ListBox have the text *and* the value of the
ones removed from the "From" ListBox
Hope this helps
Martin
"ScoutLee" <ScoutLee@.discussions.microsoft.com> wrote in message
news:D6DA1B2E-1030-4618-94AE-E43069303EDB@.microsoft.com...
> I have two listboxes. The first listbox is prepopulated with the
selections
> that the user has. The "Value" of the items is NOT the same as the
"Text".
> The user can select an item (or items) from one listbox and move it to the
> other listbox. The code for it is:
> Dim x, deleted As Integer
> For x = 0 To lboxFrom.Items.Count - 1
> If lboxFrom.Items.Item(x - deleted).Selected Then
> lboxTo.Items.Add(lboxFrom.Items.Item(x - deleted))
> lboxFrom.Items.Remove(lboxFrom.Items.Item(x - deleted))
> deleted += 1
> End If
> Next
> I have also tried:
> Dim x, deleted As Integer
> For x = 0 To lboxFrom.Items.Count - 1
> If lboxFrom.Items.Item(x - deleted).Selected Then
> Dim newItem As New ListItem()
> newItem.Text = lboxFrom.Items.Item(x - deleted).Text
> newItem.Value = lboxFrom.Items.Item(x - deleted).Value
> lboxTo.Items.Add(newItem)
> lboxFrom.Items.Remove(lboxFrom.Items.Item(x - deleted))
> deleted += 1
> End If
> Next
> The item that passes to the second listbox should have value of the first
> listbox item and also the text of the first listbox item. My problem is
that
> the value and the text of the item placed in the second listbox end up the
> same and equal the text of the item in the first listbox. Why is it doing
> this and what can I do to get the value for the item from the first
listbox
> to pass as the value for the item in the second listbox?
> Thanks.
>

pass login info back from web service

I am trying to build a web service and link it to my site for authenitcation of users

works fine as long as i am check for a boolean

what i want to do is have it pass back several parameters -- accesslevel, firstname, lastname

how can i do this?

and how can i get the different values into my asp.net page?

you can define your own soap header where you deliver your requested data.

before you execute your webservice, you verify the header information and then you run into your method.

even if you dont speak german, check the code sample at the following page:http://www.aspheute.com/artikel/20030501.htm this explains it pretty simple..


You can either return a DataSet containing a DataTable with the required columns, or create a custom class that has these as fields (make sure it is serializable).

pass more than one parm

hey all,
i'm in a template column of a gridview. i have a hyperlink in the Item
Template and i'm trying to do a custom binding expression to it. So far i
have the following:

Eval("FILE_ID", "~/ViewFile.aspx?Id={0}")

Is there a way to pass more than one parm? If so, could someone please show
me the syntax?

thanks,
rodchar"rodchar" wrote:

Quote:

Originally Posted by

hey all,
i'm in a template column of a gridview. i have a hyperlink in the Item
Template and i'm trying to do a custom binding expression to it. So far i
have the following:
>
Eval("FILE_ID", "~/ViewFile.aspx?Id={0}")
>
Is there a way to pass more than one parm? If so, could someone please show
me the syntax?
>
thanks,
rodchar


rod,

Inside your binding syntax, you'll have to call another formating function
that takes multiple arguments. Try this:

<ItemTemplate>
<asp:HyperLink ID="lnkTest" runat="server"
NavigateUrl='<%# String.Format("~/Temp.aspx?id={0}&id2={1}", Eval("id1"),
Eval("id2")) %>' Text="Link 1"></asp:HyperLink>
</ItemTemplate>

If your binding is more complicated than what string.Format() can handle
then declare a function in your codebehind and call that function inside your
templated column. Something like:

inside your codebehind declare a function...

public string FormatURL(string arg1, string arg2)
{
return string.Format("~/Temp.aspx?id={0}&id1={1}", arg1, arg2);
}

<ItemTemplate>
<asp:HyperLink ID="lnkAnotherTest" runat="server"
NavigateUrl='<%# FormatURL(Eval("id1").ToString(), Eval("id2")).ToString()
%>' Text="Link 2">
</asp:HyperLink>
</ItemTemplate>

Hope this helps,
Jason Vermillion
awesome, thank you for the help. rod.

"Jason Vermillion" wrote:

Quote:

Originally Posted by

"rodchar" wrote:

Quote:

Originally Posted by

hey all,
i'm in a template column of a gridview. i have a hyperlink in the Item
Template and i'm trying to do a custom binding expression to it. So far i
have the following:

Eval("FILE_ID", "~/ViewFile.aspx?Id={0}")

Is there a way to pass more than one parm? If so, could someone please show
me the syntax?

thanks,
rodchar


>
rod,
>
Inside your binding syntax, you'll have to call another formating function
that takes multiple arguments. Try this:
>
<ItemTemplate>
<asp:HyperLink ID="lnkTest" runat="server"
NavigateUrl='<%# String.Format("~/Temp.aspx?id={0}&id2={1}", Eval("id1"),
Eval("id2")) %>' Text="Link 1"></asp:HyperLink>
</ItemTemplate>
>
If your binding is more complicated than what string.Format() can handle
then declare a function in your codebehind and call that function inside your
templated column. Something like:
>
inside your codebehind declare a function...
>
public string FormatURL(string arg1, string arg2)
{
return string.Format("~/Temp.aspx?id={0}&id1={1}", arg1, arg2);
}
>
>
<ItemTemplate>
<asp:HyperLink ID="lnkAnotherTest" runat="server"
NavigateUrl='<%# FormatURL(Eval("id1").ToString(), Eval("id2")).ToString()
%>' Text="Link 2">
</asp:HyperLink>
</ItemTemplate>
>
Hope this helps,
Jason Vermillion
>
>

Pass message

Dear,

Please let me know about querystring or howevery u know.Im tyring to pass one message one aspx page to second aspx page how can i make sentence.plz write down for me with example

This may help:

http://msdn.microsoft.com/msdnmag/issues/07/03/CuttingEdge/default.aspx?loc=en
http://www.codeproject.com/aspnet/QueryString.asp
http://www.eggheadcafe.com/articles/20060427.asp

I hope it helps. Regards,


Check below my blog post

Ways to pass data between webforms

HC

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 multiple parameters into pages querystring property from jscript

This is a basic question but I cant seem to find the answer anywhere and
have never tried it before.

Here's one of many syntax I'm trying, but should at least show you what I'm
trying to do:

parent.data.frameElement.src="data.aspx?Task=CartAddNew & sku=" + ItemSku;

where there's 2 parameters, Task and sku, and I'm trying to pass a text
value of "CartAddNew" to the Task parameter and a value from the ItemSku
variable to the sku parameter.

Thanks.

--
moondaddy@dotnet.itags.org.nospam.comI found the answer in another posting when I searched on "Pass"

The correct way to separate the 2 parameters and their value assignments is
with a & and no spaces on each side. I had tried it with a space on each
side which made it fail. Here's what worked for me:

parent.data.frameElement.src="data.aspx?Task=CartAddNew&sku=" + sku;

refer to my post below for clarification on the value assignments.

--
moondaddy@.nospam.com
"moondaddy" <moondaddy@.nospam.com> wrote in message
news:%23C96wii$DHA.3960@.TK2MSFTNGP10.phx.gbl...
> This is a basic question but I cant seem to find the answer anywhere and
> have never tried it before.
> Here's one of many syntax I'm trying, but should at least show you what
I'm
> trying to do:
> parent.data.frameElement.src="data.aspx?Task=CartAddNew & sku=" + ItemSku;
> where there's 2 parameters, Task and sku, and I'm trying to pass a text
> value of "CartAddNew" to the Task parameter and a value from the ItemSku
> variable to the sku parameter.
> Thanks.
> --
> moondaddy@.nospam.com

pass more than one parm

hey all,
i'm in a template column of a gridview. i have a hyperlink in the Item
Template and i'm trying to do a custom binding expression to it. So far i
have the following:
Eval("FILE_ID", "~/ViewFile.aspx?Id={0}")
Is there a way to pass more than one parm? If so, could someone please show
me the syntax?
thanks,
rodchar"rodchar" wrote:
> hey all,
> i'm in a template column of a gridview. i have a hyperlink in the Item
> Template and i'm trying to do a custom binding expression to it. So far i
> have the following:
> Eval("FILE_ID", "~/ViewFile.aspx?Id={0}")
> Is there a way to pass more than one parm? If so, could someone please sho
w
> me the syntax?
> thanks,
> rodchar
rod,
Inside your binding syntax, you'll have to call another formating function
that takes multiple arguments. Try this:
<ItemTemplate>
<asp:HyperLink ID="lnkTest" runat="server"
NavigateUrl='<%# String.Format("~/Temp.aspx?id={0}&id2={1}", Eval("id1"),
Eval("id2")) %>' Text="Link 1"></asp:HyperLink>
</ItemTemplate>
If your binding is more complicated than what string.Format() can handle
then declare a function in your codebehind and call that function inside you
r
templated column. Something like:
inside your codebehind declare a function...
public string FormatURL(string arg1, string arg2)
{
return string.Format("~/Temp.aspx?id={0}&id1={1}", arg1, arg2);
}
<ItemTemplate>
<asp:HyperLink ID="lnkAnotherTest" runat="server"
NavigateUrl='<%# FormatURL(Eval("id1").ToString(), Eval("id2")).ToString()
%>' Text="Link 2">
</asp:HyperLink>
</ItemTemplate>
Hope this helps,
Jason Vermillion
awesome, thank you for the help. rod.
"Jason Vermillion" wrote:

> "rodchar" wrote:
> rod,
> Inside your binding syntax, you'll have to call another formating function
> that takes multiple arguments. Try this:
> <ItemTemplate>
> <asp:HyperLink ID="lnkTest" runat="server"
> NavigateUrl='<%# String.Format("~/Temp.aspx?id={0}&id2={1}", Eval("id1"),
> Eval("id2")) %>' Text="Link 1"></asp:HyperLink>
> </ItemTemplate>
> If your binding is more complicated than what string.Format() can handle
> then declare a function in your codebehind and call that function inside y
our
> templated column. Something like:
> inside your codebehind declare a function...
> public string FormatURL(string arg1, string arg2)
> {
> return string.Format("~/Temp.aspx?id={0}&id1={1}", arg1, arg2);
> }
>
> <ItemTemplate>
> <asp:HyperLink ID="lnkAnotherTest" runat="server"
> NavigateUrl='<%# FormatURL(Eval("id1").ToString(), Eval("id2")).ToString()
> %>' Text="Link 2">
> </asp:HyperLink>
> </ItemTemplate>
> Hope this helps,
> Jason Vermillion
>

pass my dropdownlist

hey all,
i'm in vs2005 designer view editing a formview's edit template. i have a
dropdownlist and i'm trying to bind the SelectedValue to a custom expression
.
i was wondering if it is possible to pass the dropdownlist object down to th
e
code-behind? i tried using the this keyword but that didn't work.
thanks,
rodcharCan you please eloborate a little more?
Are you trying to access the Dropdownlist in the designer or in some
routine in the code behind?
If it is in the code behind of the samepage where the dropdown is declared,
I do not see any problem accessing it.
Can you give an example of your code?
--
>Thread-Topic: pass my dropdownlist
>thread-index: Acg2ih2bZVRS0qv3TbWr/MzGXJ0Yjg==
>X-WBNR-Posting-Host: 24.214.205.110
>From: examnotes <rodchar@.discussions.microsoft.com>
>Subject: pass my dropdownlist
>Date: Tue, 4 Dec 2007 07:27:01 -0800
>Lines: 8
>Message-ID: <31752D5F-72C8-4B2C-ACA5-E868CEF35F42@.microsoft.com>
>MIME-Version: 1.0
>Content-Type: text/plain;
> charset="Utf-8"
>Content-Transfer-Encoding: 7bit
>X-Newsreader: Microsoft CDO for Windows 2000
>Content-Class: urn:content-classes:message
>Importance: normal
>Priority: normal
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2992
>Newsgroups: microsoft.public.dotnet.framework.aspnet
>Path: TK2MSFTNGHUB02.phx.gbl
>Xref: TK2MSFTNGHUB02.phx.gbl microsoft.public.dotnet.framework.aspnet:52357
>NNTP-Posting-Host: tk2msftibfm01.phx.gbl 10.40.244.149
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
>hey all,
>i'm in vs2005 designer view editing a formview's edit template. i have a
>dropdownlist and i'm trying to bind the SelectedValue to a custom
expression.
>i was wondering if it is possible to pass the dropdownlist object down to
the
>code-behind? i tried using the this keyword but that didn't work.
>thanks,
>rodchar
>
Thank You,
Nanda Lella,
This Posting is provided "AS IS" with no warranties, and confers no rights.
you're right, i just realized how obvious my question was after i posted. i
apologize.
"Nanda Lella[MSFT]" wrote:

> Can you please eloborate a little more?
> Are you trying to access the Dropdownlist in the designer or in some
> routine in the code behind?
> If it is in the code behind of the samepage where the dropdown is declared
,
> I do not see any problem accessing it.
> Can you give an example of your code?
> --
> expression.
> the
> --
> Thank You,
> Nanda Lella,
> This Posting is provided "AS IS" with no warranties, and confers no rights
.
>

pass my dropdownlist

hey all,
i'm in vs2005 designer view editing a formview's edit template. i have a
dropdownlist and i'm trying to bind the SelectedValue to a custom expression.
i was wondering if it is possible to pass the dropdownlist object down to the
code-behind? i tried using the this keyword but that didn't work.

thanks,
rodcharCan you please eloborate a little more?
Are you trying to access the Dropdownlist in the designer or in some
routine in the code behind?
If it is in the code behind of the samepage where the dropdown is declared,
I do not see any problem accessing it.

Can you give an example of your code?

-------

Quote:

Originally Posted by

>Thread-Topic: pass my dropdownlist
>thread-index: Acg2ih2bZVRS0qv3TbWr/MzGXJ0Yjg==
>X-WBNR-Posting-Host: 24.214.205.110
>From: =?Utf-8?B?cm9kY2hhcg==?= <rodchar@.discussions.microsoft.com>
>Subject: pass my dropdownlist
>Date: Tue, 4 Dec 2007 07:27:01 -0800
>Lines: 8
>Message-ID: <31752D5F-72C8-4B2C-ACA5-E868CEF35F42@.microsoft.com>
>MIME-Version: 1.0
>Content-Type: text/plain;
>charset="Utf-8"
>Content-Transfer-Encoding: 7bit
>X-Newsreader: Microsoft CDO for Windows 2000
>Content-Class: urn:content-classes:message
>Importance: normal
>Priority: normal
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2992
>Newsgroups: microsoft.public.dotnet.framework.aspnet
>Path: TK2MSFTNGHUB02.phx.gbl
>Xref: TK2MSFTNGHUB02.phx.gbl microsoft.public.dotnet.framework.aspnet:52357
>NNTP-Posting-Host: tk2msftibfm01.phx.gbl 10.40.244.149
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
>
>hey all,
>i'm in vs2005 designer view editing a formview's edit template. i have a
>dropdownlist and i'm trying to bind the SelectedValue to a custom


expression.

Quote:

Originally Posted by

>i was wondering if it is possible to pass the dropdownlist object down to


the

Quote:

Originally Posted by

>code-behind? i tried using the this keyword but that didn't work.
>
>thanks,
>rodchar
>


--

Thank You,
Nanda Lella,

This Posting is provided "AS IS" with no warranties, and confers no rights.
you're right, i just realized how obvious my question was after i posted. i
apologize.

"Nanda Lella[MSFT]" wrote:

Quote:

Originally Posted by

Can you please eloborate a little more?
Are you trying to access the Dropdownlist in the designer or in some
routine in the code behind?
If it is in the code behind of the samepage where the dropdown is declared,
I do not see any problem accessing it.
>
Can you give an example of your code?
>
-------

Quote:

Originally Posted by

Thread-Topic: pass my dropdownlist
thread-index: Acg2ih2bZVRS0qv3TbWr/MzGXJ0Yjg==
X-WBNR-Posting-Host: 24.214.205.110
From: =?Utf-8?B?cm9kY2hhcg==?= <rodchar@.discussions.microsoft.com>
Subject: pass my dropdownlist
Date: Tue, 4 Dec 2007 07:27:01 -0800
Lines: 8
Message-ID: <31752D5F-72C8-4B2C-ACA5-E868CEF35F42@.microsoft.com>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2992
Newsgroups: microsoft.public.dotnet.framework.aspnet
Path: TK2MSFTNGHUB02.phx.gbl
Xref: TK2MSFTNGHUB02.phx.gbl microsoft.public.dotnet.framework.aspnet:52357
NNTP-Posting-Host: tk2msftibfm01.phx.gbl 10.40.244.149
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

hey all,
i'm in vs2005 designer view editing a formview's edit template. i have a
dropdownlist and i'm trying to bind the SelectedValue to a custom


expression.

Quote:

Originally Posted by

i was wondering if it is possible to pass the dropdownlist object down to


the

Quote:

Originally Posted by

code-behind? i tried using the this keyword but that didn't work.

thanks,
rodchar


>
--
>
Thank You,
Nanda Lella,
>
This Posting is provided "AS IS" with no warranties, and confers no rights.
>
>

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 NULL To Stored Procedure

How do I pass a NULL value to a field while inserting records in a SQL
Server 2005 DB table using a stored procedure? I tried the following
but it inserts an empty string & not a NULL value:
ALTER PROCEDURE dbo.Purchase
@dotnet.itags.org.UserID int,
@dotnet.itags.org.Total decimal,
@dotnet.itags.org.Address varchar(250) = NULL,
@dotnet.itags.org.Country varchar(50) = NULL
AS
INSERT INTO Order (UserID, Address, Country, Total) VALUES (@dotnet.itags.org.UserID,
@dotnet.itags.org.Address, @dotnet.itags.org.Country, @dotnet.itags.org.Total)
I am invoking the above SP with this code in a class file:
Public Class Cart
Public Sub PlaceOrder(ByVal UserID As Integer, ByVal Total As
Double, ByVal Address As String, ByVal Country As String)
Dim sqlConn As SqlConnection
Dim sqlCmd As SqlCommand
sqlConn = New SqlConnection("....")
sqlCmd = New SqlCommand("Purchase", sqlConn)
sqlCmd.CommandType = CommandType.StoredProcedure
With sqlCmd
.Parameters.Add("@dotnet.itags.org.UserID", SqlDbType.Int).Value = UserID
.Parameters.Add("@dotnet.itags.org.Total", SqlDbType.Decimal).Value = Total
.Parameters.Add("@dotnet.itags.org.Address", SqlDbType.VarChar, 250).Value =
Address
.Parameters.Add("@dotnet.itags.org.Country", SqlDbType.VarChar, 50).Value =
Country
End With
sqlConn.Open()
sqlCmd.ExecuteNonQuery()
sqlConn.Close()
End Sub
End Class
Using vbc, I compiled the above into a DLL named Cart.dll.
This is the ASPX code (if no values are supplied for the variables
'strAddress' & 'strCountry', those records should be inserted as NULLs
in the DB table):
Sub Submit_Click(....)
Dim boCart As Cart
boCart = New Cart
If (strAddress = "") Then
strAddress = DBNull.Value.ToString
End If
If (strCountry = "") Then
strCountry = DBNull.Value.ToString
End If
boCart.PlaceOrder(iUserID, dblTotal, strAddress, strCountry)
End Sub<rn5a@.rediffmail.com> wrote in message
news:1160169983.937789.306620@.k70g2000cwa.googlegroups.com...

> How do I pass a NULL value to a field while inserting records in a SQL
> Server 2005 DB table using a stored procedure? I tried the following
> but it inserts an empty string & not a NULL value:
.Parameters.Add("@.Address", SqlDbType.VarChar, 250).Value = DbNull.Value
Plus what Mark mention
I think you can set your instance to Nothing
like:
address = nothing;
but if you your object is value type, you have to use the way Mark Mentioned
--
Muhammad Mosa
Software Engineer & Solution Developer
MCT/MCSD.NET
MCTS: .Net 2.0 Web Applications
MCTS: .Net 2.0 Windows Applications
"rn5a@.rediffmail.com" wrote:

> How do I pass a NULL value to a field while inserting records in a SQL
> Server 2005 DB table using a stored procedure? I tried the following
> but it inserts an empty string & not a NULL value:
> ALTER PROCEDURE dbo.Purchase
> @.UserID int,
> @.Total decimal,
> @.Address varchar(250) = NULL,
> @.Country varchar(50) = NULL
> AS
> INSERT INTO Order (UserID, Address, Country, Total) VALUES (@.UserID,
> @.Address, @.Country, @.Total)
> I am invoking the above SP with this code in a class file:
> Public Class Cart
> Public Sub PlaceOrder(ByVal UserID As Integer, ByVal Total As
> Double, ByVal Address As String, ByVal Country As String)
> Dim sqlConn As SqlConnection
> Dim sqlCmd As SqlCommand
> sqlConn = New SqlConnection("....")
> sqlCmd = New SqlCommand("Purchase", sqlConn)
> sqlCmd.CommandType = CommandType.StoredProcedure
> With sqlCmd
> .Parameters.Add("@.UserID", SqlDbType.Int).Value = UserID
> .Parameters.Add("@.Total", SqlDbType.Decimal).Value = Total
> .Parameters.Add("@.Address", SqlDbType.VarChar, 250).Value =
> Address
> .Parameters.Add("@.Country", SqlDbType.VarChar, 50).Value =
> Country
> End With
> sqlConn.Open()
> sqlCmd.ExecuteNonQuery()
> sqlConn.Close()
> End Sub
> End Class
> Using vbc, I compiled the above into a DLL named Cart.dll.
> This is the ASPX code (if no values are supplied for the variables
> 'strAddress' & 'strCountry', those records should be inserted as NULLs
> in the DB table):
> Sub Submit_Click(....)
> Dim boCart As Cart
> boCart = New Cart
> If (strAddress = "") Then
> strAddress = DBNull.Value.ToString
> End If
> If (strCountry = "") Then
> strCountry = DBNull.Value.ToString
> End If
> boCart.PlaceOrder(iUserID, dblTotal, strAddress, strCountry)
> End Sub
>

Pass NULL To Stored Procedure

How do I pass a NULL value to a field while inserting records in a SQL
Server 2005 DB table using a stored procedure? I tried the following
but it inserts an empty string & not a NULL value:

ALTER PROCEDURE dbo.Purchase
@dotnet.itags.org.UserID int,
@dotnet.itags.org.Total decimal,
@dotnet.itags.org.Address varchar(250) = NULL,
@dotnet.itags.org.Country varchar(50) = NULL
AS

INSERT INTO Order (UserID, Address, Country, Total) VALUES (@dotnet.itags.org.UserID,
@dotnet.itags.org.Address, @dotnet.itags.org.Country, @dotnet.itags.org.Total)

I am invoking the above SP with this code in a class file:

Public Class Cart
Public Sub PlaceOrder(ByVal UserID As Integer, ByVal Total As
Double, ByVal Address As String, ByVal Country As String)
Dim sqlConn As SqlConnection
Dim sqlCmd As SqlCommand

sqlConn = New SqlConnection("....")
sqlCmd = New SqlCommand("Purchase", sqlConn)
sqlCmd.CommandType = CommandType.StoredProcedure

With sqlCmd
.Parameters.Add("@dotnet.itags.org.UserID", SqlDbType.Int).Value = UserID
.Parameters.Add("@dotnet.itags.org.Total", SqlDbType.Decimal).Value = Total
.Parameters.Add("@dotnet.itags.org.Address", SqlDbType.VarChar, 250).Value =
Address
.Parameters.Add("@dotnet.itags.org.Country", SqlDbType.VarChar, 50).Value =
Country
End With

sqlConn.Open()
sqlCmd.ExecuteNonQuery()
sqlConn.Close()
End Sub
End Class

Using vbc, I compiled the above into a DLL named Cart.dll.

This is the ASPX code (if no values are supplied for the variables
'strAddress' & 'strCountry', those records should be inserted as NULLs
in the DB table):

Sub Submit_Click(....)
Dim boCart As Cart
boCart = New Cart

If (strAddress = "") Then
strAddress = DBNull.Value.ToString
End If

If (strCountry = "") Then
strCountry = DBNull.Value.ToString
End If

boCart.PlaceOrder(iUserID, dblTotal, strAddress, strCountry)
End Sub<rn5a@.rediffmail.comwrote in message
news:1160169983.937789.306620@.k70g2000cwa.googlegr oups.com...

Quote:

Originally Posted by

How do I pass a NULL value to a field while inserting records in a SQL
Server 2005 DB table using a stored procedure? I tried the following
but it inserts an empty string & not a NULL value:


..Parameters.Add("@.Address", SqlDbType.VarChar, 250).Value = DbNull.Value
Plus what Mark mention
I think you can set your instance to Nothing
like:
address = nothing;
but if you your object is value type, you have to use the way Mark Mentioned
--
Muhammad Mosa
Software Engineer & Solution Developer
MCT/MCSD.NET
MCTS: .Net 2.0 Web Applications
MCTS: .Net 2.0 Windows Applications

"rn5a@.rediffmail.com" wrote:

Quote:

Originally Posted by

How do I pass a NULL value to a field while inserting records in a SQL
Server 2005 DB table using a stored procedure? I tried the following
but it inserts an empty string & not a NULL value:
>
ALTER PROCEDURE dbo.Purchase
@.UserID int,
@.Total decimal,
@.Address varchar(250) = NULL,
@.Country varchar(50) = NULL
AS
>
INSERT INTO Order (UserID, Address, Country, Total) VALUES (@.UserID,
@.Address, @.Country, @.Total)
>
I am invoking the above SP with this code in a class file:
>
Public Class Cart
Public Sub PlaceOrder(ByVal UserID As Integer, ByVal Total As
Double, ByVal Address As String, ByVal Country As String)
Dim sqlConn As SqlConnection
Dim sqlCmd As SqlCommand
>
sqlConn = New SqlConnection("....")
sqlCmd = New SqlCommand("Purchase", sqlConn)
sqlCmd.CommandType = CommandType.StoredProcedure
>
With sqlCmd
.Parameters.Add("@.UserID", SqlDbType.Int).Value = UserID
.Parameters.Add("@.Total", SqlDbType.Decimal).Value = Total
.Parameters.Add("@.Address", SqlDbType.VarChar, 250).Value =
Address
.Parameters.Add("@.Country", SqlDbType.VarChar, 50).Value =
Country
End With
>
sqlConn.Open()
sqlCmd.ExecuteNonQuery()
sqlConn.Close()
End Sub
End Class
>
Using vbc, I compiled the above into a DLL named Cart.dll.
>
This is the ASPX code (if no values are supplied for the variables
'strAddress' & 'strCountry', those records should be inserted as NULLs
in the DB table):
>
Sub Submit_Click(....)
Dim boCart As Cart
boCart = New Cart
>
If (strAddress = "") Then
strAddress = DBNull.Value.ToString
End If
>
If (strCountry = "") Then
strCountry = DBNull.Value.ToString
End If
>
boCart.PlaceOrder(iUserID, dblTotal, strAddress, strCountry)
End Sub
>
>

Pass Object from one page to another

Hi, I have one page that has several methods that populate an ArrayList with data. I want to be able to pass this populated ArrayList to another page on the site. Is there any way that this can be done? I know values can be passed using the QueryString, but I need the whole ArrayList object to be passed.

Any help would be greatly appreciated.
Thanks

You can store it in a session variable:http://msdn2.microsoft.com/en-us/library/ms178581.aspx

From the page:

By default, session variables can be any valid .NET type. For example, the following code example stores anArrayListof values in a session variable named "StockPicks." Note that the valuereturned by the "StockPicks" session variable must be cast as theappropriate type upon retrieval from theSessionStateItemCollection.


1) You can keep the arraylist in the session object and can access the session object into another page.

2) You can make serializable class file and make the public object. By using context handler you can access the public object into another page.

Regards,

Suhas


Suhas.Chitade:

2) You can make serializable class file and make the public object. By using context handler you can access the public object into another page.

I've never tried this approach before. Would it mean that the same object is available to all users? Also, how long would the object persist?

Pass one variable from one form to other

Hi,

I want to transfer the value of one variable ( basicaly text of a text filed) from one form to other form ...

i tried Server.Transfer("next_form.aspx") ..and then tried Request.Form("text_field") to retrieve it's content .. but doesnt work ...

i also tried Response.Redirect("next_form.aspx") ..and then tried Request.Form("text_field") to retrieve it's content .. but doesnt work ...

I think i am doing it wrong ... how can i do it .. anyone plz help :(

Thanks
imranIn your first form, put the following in your sub that gets called when you submit the form...

Response.Redirect("form2.aspx?myValue=" & myTextBox.Text)

Then in your second page...

Sub Page_Load()
TextBox2.Text = Request.QueryString("myValue")
End Sub
Hi,

When using Server.Transfer its preserveForm arguement to TRUE. This makes viewstate, event procedure available in destination form.

When using Response.Redirect, you can use querystring to pass information to the destination form like Response.Redirect("test.aspx?id=10");

HTH,
Shamir
Also see below article it could helps you

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

Pass Parameter As DataGridItemEventArgs

A Form has a DataGrid & a Button. The DataGrid's ItemDataBound event
calls a sub named 'BindData'. This sub first finds a Label which exists
in the ItemTemplate of the TemplateColumn of the DataGrid & does some
work with the Label.
Sub BindData(obj As Object, ea As DataGridItemEventArgs)
Dim lbl As Label
If (ea.Item.ItemType = ListItemType.Item Or ea.Item.ItemType =
ListItemType.AlternatingItem) Then
lbl = ea.Item.FindControl("lblAcre")
...
...
End If
End Sub
The Button has the Click event which invokes a sub named 'SubmitPage'.
Sub SubmitPage(obj As Object, ea As EventArgs)
...
End Sub
Now I did like the 'SubmitPage' sub to invoke the 'BindData' sub. How
do I accomplish this? In other words, what parameters do I pass from
the 'SubmitPage' sub to the 'BindData' sub which the latter expects?You can't get DataGridItemEventArgs in SubmitPage (it is event argument data
type specific to a event, so it's not even wise to use as input to a
method), but you can loop through the DataGrid manually.
Sub SubmitPage(obj As Object, ea As EventArgs)
For each dgitem As DataGridItem in DataGrid1.Items
Dim lbl As Label=Nothing
If (dgitem.ItemType = ListItemType.Item Or dgitem.ItemType =
ListItemType.AlternatingItem) Then
lbl = dgitem.FindControl("lblAcre")
'Do something with the Label
End If
Next
End Sub
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
<rn5a@.rediffmail.com> wrote in message
news:1165068166.263744.157190@.l12g2000cwl.googlegroups.com...
>A Form has a DataGrid & a Button. The DataGrid's ItemDataBound event
> calls a sub named 'BindData'. This sub first finds a Label which exists
> in the ItemTemplate of the TemplateColumn of the DataGrid & does some
> work with the Label.
> Sub BindData(obj As Object, ea As DataGridItemEventArgs)
> Dim lbl As Label
> If (ea.Item.ItemType = ListItemType.Item Or ea.Item.ItemType =
> ListItemType.AlternatingItem) Then
> lbl = ea.Item.FindControl("lblAcre")
> ....
> ....
> End If
> End Sub
> The Button has the Click event which invokes a sub named 'SubmitPage'.
> Sub SubmitPage(obj As Object, ea As EventArgs)
> ....
> End Sub
> Now I did like the 'SubmitPage' sub to invoke the 'BindData' sub. How
> do I accomplish this? In other words, what parameters do I pass from
> the 'SubmitPage' sub to the 'BindData' sub which the latter expects?
>
Thanks, Teemu...that's exactly what I was looking out for
Teemu Keiski wrote:
> You can't get DataGridItemEventArgs in SubmitPage (it is event argument da
ta
> type specific to a event, so it's not even wise to use as input to a
> method), but you can loop through the DataGrid manually.
> Sub SubmitPage(obj As Object, ea As EventArgs)
>
> For each dgitem As DataGridItem in DataGrid1.Items
> Dim lbl As Label=Nothing
> If (dgitem.ItemType = ListItemType.Item Or dgitem.ItemType =
> ListItemType.AlternatingItem) Then
> lbl = dgitem.FindControl("lblAcre")
> 'Do something with the Label
> End If
> Next
> End Sub
>
> --
> Teemu Keiski
> ASP.NET MVP, AspInsider
> Finland, EU
> http://blogs.aspadvice.com/joteke
> <rn5a@.rediffmail.com> wrote in message
> news:1165068166.263744.157190@.l12g2000cwl.googlegroups.com...

Pass Parameter As DataGridItemEventArgs

A Form has a DataGrid & a Button. The DataGrid's ItemDataBound event
calls a sub named 'BindData'. This sub first finds a Label which exists
in the ItemTemplate of the TemplateColumn of the DataGrid & does some
work with the Label.

Sub BindData(obj As Object, ea As DataGridItemEventArgs)
Dim lbl As Label

If (ea.Item.ItemType = ListItemType.Item Or ea.Item.ItemType =
ListItemType.AlternatingItem) Then
lbl = ea.Item.FindControl("lblAcre")
....
....
End If
End Sub

The Button has the Click event which invokes a sub named 'SubmitPage'.

Sub SubmitPage(obj As Object, ea As EventArgs)
....
End Sub

Now I did like the 'SubmitPage' sub to invoke the 'BindData' sub. How
do I accomplish this? In other words, what parameters do I pass from
the 'SubmitPage' sub to the 'BindData' sub which the latter expects?You can't get DataGridItemEventArgs in SubmitPage (it is event argument data
type specific to a event, so it's not even wise to use as input to a
method), but you can loop through the DataGrid manually.

Sub SubmitPage(obj As Object, ea As EventArgs)

For each dgitem As DataGridItem in DataGrid1.Items

Dim lbl As Label=Nothing

If (dgitem.ItemType = ListItemType.Item Or dgitem.ItemType =
ListItemType.AlternatingItem) Then
lbl = dgitem.FindControl("lblAcre")
'Do something with the Label
End If

Next

End Sub

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
<rn5a@.rediffmail.comwrote in message
news:1165068166.263744.157190@.l12g2000cwl.googlegr oups.com...

Quote:

Originally Posted by

>A Form has a DataGrid & a Button. The DataGrid's ItemDataBound event
calls a sub named 'BindData'. This sub first finds a Label which exists
in the ItemTemplate of the TemplateColumn of the DataGrid & does some
work with the Label.
>
Sub BindData(obj As Object, ea As DataGridItemEventArgs)
Dim lbl As Label
>
If (ea.Item.ItemType = ListItemType.Item Or ea.Item.ItemType =
ListItemType.AlternatingItem) Then
lbl = ea.Item.FindControl("lblAcre")
....
....
End If
End Sub
>
The Button has the Click event which invokes a sub named 'SubmitPage'.
>
Sub SubmitPage(obj As Object, ea As EventArgs)
....
End Sub
>
Now I did like the 'SubmitPage' sub to invoke the 'BindData' sub. How
do I accomplish this? In other words, what parameters do I pass from
the 'SubmitPage' sub to the 'BindData' sub which the latter expects?
>


Thanks, Teemu...that's exactly what I was looking out for

Teemu Keiski wrote:

Quote:

Originally Posted by

You can't get DataGridItemEventArgs in SubmitPage (it is event argument data
type specific to a event, so it's not even wise to use as input to a
method), but you can loop through the DataGrid manually.
>
Sub SubmitPage(obj As Object, ea As EventArgs)
>
>
For each dgitem As DataGridItem in DataGrid1.Items
>
Dim lbl As Label=Nothing
>
If (dgitem.ItemType = ListItemType.Item Or dgitem.ItemType =
ListItemType.AlternatingItem) Then
lbl = dgitem.FindControl("lblAcre")
'Do something with the Label
End If
>
Next
>
End Sub
>
>
--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
>
<rn5a@.rediffmail.comwrote in message
news:1165068166.263744.157190@.l12g2000cwl.googlegr oups.com...

Quote:

Originally Posted by

A Form has a DataGrid & a Button. The DataGrid's ItemDataBound event
calls a sub named 'BindData'. This sub first finds a Label which exists
in the ItemTemplate of the TemplateColumn of the DataGrid & does some
work with the Label.

Sub BindData(obj As Object, ea As DataGridItemEventArgs)
Dim lbl As Label

If (ea.Item.ItemType = ListItemType.Item Or ea.Item.ItemType =
ListItemType.AlternatingItem) Then
lbl = ea.Item.FindControl("lblAcre")
....
....
End If
End Sub

The Button has the Click event which invokes a sub named 'SubmitPage'.

Sub SubmitPage(obj As Object, ea As EventArgs)
....
End Sub

Now I did like the 'SubmitPage' sub to invoke the 'BindData' sub. How
do I accomplish this? In other words, what parameters do I pass from
the 'SubmitPage' sub to the 'BindData' sub which the latter expects?

pass parameter in hyperlink

Hi

I am displaying the results of a query in a datalist. There are 2 fields returned with one an icon set as a hyperlink as follows:

Smile [:)]
name

When someone clicks on the icon I would like the name parameter to be passed to a new page to be used in a new query. Can someone please point me in the right direction.

Matt

The simplest way of doing this is to append the name as a query string variable, e.g.

<a href="http://links.10026.com/?link=http://someurl.com?name=xyz">...</a>


Thanks for the quick response. My code looks as follows:

<ItemTemplate>

<asp:HyperLink ID="Hyperlink1" runat="server" NavigateUrl="~/Login.aspx"><asp:Image ID="Image1" runat="server" ImageUrl='<%# SetUrl(Eval("status")) %>' ImageAlign="Middle" /></asp:HyperLink><br />
<asp:Label ID="term_idLabel" runat="server" Text='<%# Eval("term_id") %>' Font-Names="Arial" Font-Size="Small" ForeColor="White"></asp:Label><br />
<br />
</ItemTemplate
Which displays my data as:

Smile [:)] Big Smile [:D]
name1 name2

If the user clicks on name1's icon I'd like to pass name1 as the parameter. How do I access this term_idLabel instance?
You'll want to change the NavigateUrl property in HyperLink1 so the term_id is evaluated and passed as a parameter. Try this:

NavigateUrl='<%# Eval("term_id", "~/Login.aspx?name={0}") %>'
The string will be formatted with the value for term_id replacing the {0}.

Pass Parameter To MasterPage ?

How do you pass a parameter into the master pages, much like the TITLE.
I'd like to pass SectionID from the ChildPages to the MasterPage
(which calculates information based on SectionID)A good way is to declare a public property SectionID on the master page and
set it from content pages as this.Master.SectionID=xxx
You will need to add a line
<%@. MasterType virtualpath="~/MyMaster.master" %>
into your content page.
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
<googlegroup@.desiboy.com> wrote in message
news:1168928761.038462.121050@.38g2000cwa.googlegroups.com...
> How do you pass a parameter into the master pages, much like the TITLE.
> I'd like to pass SectionID from the ChildPages to the MasterPage
> (which calculates information based on SectionID)
>

Pass Parameter To MasterPage ?

How do you pass a parameter into the master pages, much like the TITLE.
I'd like to pass SectionID from the ChildPages to the MasterPage
(which calculates information based on SectionID)A good way is to declare a public property SectionID on the master page and
set it from content pages as this.Master.SectionID=xxx

You will need to add a line

<%@. MasterType virtualpath="~/MyMaster.master" %>

into your content page.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
<googlegroup@.desiboy.comwrote in message
news:1168928761.038462.121050@.38g2000cwa.googlegro ups.com...

Quote:

Originally Posted by

How do you pass a parameter into the master pages, much like the TITLE.
I'd like to pass SectionID from the ChildPages to the MasterPage
(which calculates information based on SectionID)
>

Pass Parameter to Javascript

I have javascript that accepts 2 parameters like so...
function showmsgbox(chkB, somestring)
{
xState=chkB.checked;
if(xState)
{
chkB.parentElement.parentElement.style.backgroundColor='yellow';
}
else
{
chkB.parentElement.parentElement.style.backgroundColor='whitesmoke';
}
alert(somestring);
}
I need to pass the second parameter o the function from within a datagrid
like so... Only problem is I keep getting many erros with my syntax. How
can this be accomplished?...
<asp:TemplateColumn>
<ItemTemplate>
<asp:CheckBox ID="chkBox1" onclick="javascript:HighlightRow(this, '<%#
DataBinder.Eval(Container, "DataItem.column1") %>'');" runat="server"
autopostback="False"/>
</ItemTemplate>
</asp:TemplateColumn>
Thanks.I did it through the (gridview's) row event.
Using findcontrol and adding the onclick there.
However, a few days ago this kind of syntax was posted, i haven't tried it
yet.
<asp:ImageButton id="x" OnClientClick=<%# "menu('" + Eval("TableId") +
"');return false;"%> />
Maybe it helps?
"Jay" <msnews.microsoft.com> schreef in bericht
news:OpCSvNG9FHA.1416@.TK2MSFTNGP09.phx.gbl...
>I have javascript that accepts 2 parameters like so...
> function showmsgbox(chkB, somestring)
> {
> xState=chkB.checked;
> if(xState)
> {
> chkB.parentElement.parentElement.style.backgroundColor='yellow';
> }
> else
> {
> chkB.parentElement.parentElement.style.backgroundColor='whitesmoke';
> }
> alert(somestring);
> }
> I need to pass the second parameter o the function from within a datagrid
> like so... Only problem is I keep getting many erros with my syntax. How
> can this be accomplished?...
> <asp:TemplateColumn>
> <ItemTemplate>
> <asp:CheckBox ID="chkBox1" onclick="java script:HighlightRow(this, '<%#
> DataBinder.Eval(Container, "DataItem.column1") %>'');" runat="server"
> autopostback="False"/>
> </ItemTemplate>
> </asp:TemplateColumn>
> Thanks.
>
Here is the failing code regarding that post:
<asp:ImageButton ID="ImageButton2" runat="server"
It seems menu is a function.
"Edwin Knoppert" <info@.pbsoft.speedlinq.nl> schreef in bericht
news:dmftqs$f14$1@.azure.qinip.net...
>I did it through the (gridview's) row event.
> Using findcontrol and adding the onclick there.
> However, a few days ago this kind of syntax was posted, i haven't tried it
> yet.
> <asp:ImageButton id="x" OnClientClick=<%# "menu('" + Eval("TableId") +
> "');return false;"%> />
> Maybe it helps?
>
> "Jay" <msnews.microsoft.com> schreef in bericht
> news:OpCSvNG9FHA.1416@.TK2MSFTNGP09.phx.gbl...
>
the onclick is the serverside click. in the codebehind, you to add the
client onclick in the code behind using
checkbox.Attributes["onclick"] = value;
to add at the individual level, use the ItemDataBound Event of the repeater.
-- bruce (sqlwork.com)
"Jay" <msnews.microsoft.com> wrote in message
news:OpCSvNG9FHA.1416@.TK2MSFTNGP09.phx.gbl...
>I have javascript that accepts 2 parameters like so...
> function showmsgbox(chkB, somestring)
> {
> xState=chkB.checked;
> if(xState)
> {
> chkB.parentElement.parentElement.style.backgroundColor='yellow';
> }
> else
> {
> chkB.parentElement.parentElement.style.backgroundColor='whitesmoke';
> }
> alert(somestring);
> }
> I need to pass the second parameter o the function from within a datagrid
> like so... Only problem is I keep getting many erros with my syntax. How
> can this be accomplished?...
> <asp:TemplateColumn>
> <ItemTemplate>
> <asp:CheckBox ID="chkBox1" onclick="java script:HighlightRow(this, '<%#
> DataBinder.Eval(Container, "DataItem.column1") %>'');" runat="server"
> autopostback="False"/>
> </ItemTemplate>
> </asp:TemplateColumn>
> Thanks.
>

Pass Parameter to DataList Datasource!

Hi all,

I am trying pass a value to the DataSource method in a DataList like below.
DataSource = <%# GetData(DataBinder.Eval(Container.DataItem, "ID"))%>"

I get an error with this code, and am wondering if someone can show me the
correct syntax.

I have asked this question before, but unfortunately i don't remember the
correct syntax.

I know i can acheive the desired result using code behind 'ItemDataBound',
but am prefering to do it in the aspx page itself..

All help appreciated.

<asp:DataList ID="dlTest"
DataKeyField = "ID"
DataSource = <%# GetData(DataBinder.Eval(Container.DataItem,
"ID"))%>">
<ItemTemplate><%# DataBinder.Eval(Container.DataItem,
"Name")%></ItemTemplate>
</asp:DataList>

Cheers,
AdamDataSource should be set to an on object containing data items. What is it
in your case?

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

"AJ" <AJ@.discussions.microsoft.comwrote in message
news:3C74BA0B-76DB-42B0-A32B-E2EF219A44BC@.microsoft.com...

Quote:

Originally Posted by

Hi all,
>
I am trying pass a value to the DataSource method in a DataList like
below.
DataSource = <%# GetData(DataBinder.Eval(Container.DataItem, "ID"))%>"
>
I get an error with this code, and am wondering if someone can show me the
correct syntax.
>
I have asked this question before, but unfortunately i don't remember the
correct syntax.
>
I know i can acheive the desired result using code behind 'ItemDataBound',
but am prefering to do it in the aspx page itself..
>
All help appreciated.
>
<asp:DataList ID="dlTest"
DataKeyField = "ID"
DataSource = <%# GetData(DataBinder.Eval(Container.DataItem,
"ID"))%>">
<ItemTemplate><%# DataBinder.Eval(Container.DataItem,
"Name")%></ItemTemplate>
</asp:DataList>
>
Cheers,
Adam

Pass parameter to Popup window

I have 2 webform in vb.NET application.
On Webform1, I have one text box1 and one button.
on Webform2, I have one text box .
I need transfer the value of textbox 1 in webform1 to textbox2 in
webform2. and popup webform2 when user click on the button on webform1.
I have code in webform1:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Button1.Attributes.Add("onclick", "window.open('WebForm2.aspx?a=" +
TextBox1.Text.ToString + "',null,'height=250, width=250,status= no,
resizable= no, scrollbars=no, toolbar=no,location=no,menubar=no ');")
End Sub
and following code in webform2:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
TextBox1.Text = Request("a").ToString
End Sub
I could not get the result unless I click on the button1 twice. i know
what happen in here but have no solution. I will be appreciated if you
could help here.
Thanks in advanced,
DiHi ,
You can achieve this by injecting a javascript in the Button1 click
event on the server side . Write an function to inject an javascript in the
webform1 button1 click.
Don't do anything with Attributes of button1 as it won't achieve result u
requires as the 1st page the textbox1 value would be blank.
private void openWindowInjectScript(){
string myScript;
myScript = "<scr" + "ipt>window.open('WebForm2.aspx?a=" + txtIdfield.Value
+ "',null,'height=250, width=250,status= no,resizable= no, scrollbars=no,
toolbar=no,location=no,menubar=no'); </scr" + "ipt>";
this.Page.RegisterStartupScript("JavaScript",myScript);
}
In the webform1.aspx button1_Click event
private void Button1_Click(object sender, System.EventArgs e)
{
openWindowInjectScript();
}
Basically openwindowInjectScript register a script at pageload and which
will make to open an window with current values.
This is the way out for it and it should work
Regards
IntelYogi
"dyw55a@.yahoo.com" wrote:

> I have 2 webform in vb.NET application.
> On Webform1, I have one text box1 and one button.
> on Webform2, I have one text box .
> I need transfer the value of textbox 1 in webform1 to textbox2 in
> webform2. and popup webform2 when user click on the button on webform1.
> I have code in webform1:
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> Button1.Attributes.Add("onclick", "window.open('WebForm2.aspx?a=" +
> TextBox1.Text.ToString + "',null,'height=250, width=250,status= no,
> resizable= no, scrollbars=no, toolbar=no,location=no,menubar=no ');")
> End Sub
> and following code in webform2:
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> TextBox1.Text = Request("a").ToString
> End Sub
>
> I could not get the result unless I click on the button1 twice. i know
> what happen in here but have no solution. I will be appreciated if you
> could help here.
> Thanks in advanced,
> Di
>
Thank you for your reply. But actually I tried and this did not work
for some reason, any idea?
Try this onClick event of your button
Response.Write("<SCRIPT>");
Response.Write("window.open('page,aspx?value=" + myval +
" ',null,'height=200,width=900,status=yes,
toolbar=no,menubar=no,location=no')
;
");
Response.Write("</SCRIPT>");
I think this will do the trick, tell me if not
dyw55a@.yahoo.com wrote in message news:<1117647067.875660.133640@.g43g2000cwa.googlegroups.c
om>...
> Thank you for your reply. But actually I tried and this did not work
> for some reason, any idea?

Pass parameter to Popup window

I have 2 webform in vb.NET application.
On Webform1, I have one text box1 and one button.
on Webform2, I have one text box .
I need transfer the value of textbox 1 in webform1 to textbox2 in
webform2. and popup webform2 when user click on the button on webform1.

I have code in webform1:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Button1.Attributes.Add("onclick", "window.open('WebForm2.aspx?a=" +
TextBox1.Text.ToString + "',null,'height=250, width=250,status= no,
resizable= no, scrollbars=no, toolbar=no,location=no,menubar=no ');")
End Sub

and following code in webform2:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
TextBox1.Text = Request("a").ToString
End Sub

I could not get the result unless I click on the button1 twice. i know
what happen in here but have no solution. I will be appreciated if you
could help here.

Thanks in advanced,
DiHi ,
You can achieve this by injecting a javascript in the Button1 click
event on the server side . Write an function to inject an javascript in the
webform1 button1 click.
Don't do anything with Attributes of button1 as it won't achieve result u
requires as the 1st page the textbox1 value would be blank.

private void openWindowInjectScript(){
string myScript;
myScript = "<scr" + "ipt>window.open('WebForm2.aspx?a=" + txtIdfield.Value
+ "',null,'height=250, width=250,status= no,resizable= no, scrollbars=no,
toolbar=no,location=no,menubar=no'); </scr" + "ipt>";
this.Page.RegisterStartupScript("JavaScript",myScript);
}

In the webform1.aspx button1_Click event
private void Button1_Click(object sender, System.EventArgs e)
{
openWindowInjectScript();
}
Basically openwindowInjectScript register a script at pageload and which
will make to open an window with current values.

This is the way out for it and it should work

Regards
IntelYogi

"dyw55a@.yahoo.com" wrote:

> I have 2 webform in vb.NET application.
> On Webform1, I have one text box1 and one button.
> on Webform2, I have one text box .
> I need transfer the value of textbox 1 in webform1 to textbox2 in
> webform2. and popup webform2 when user click on the button on webform1.
> I have code in webform1:
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> Button1.Attributes.Add("onclick", "window.open('WebForm2.aspx?a=" +
> TextBox1.Text.ToString + "',null,'height=250, width=250,status= no,
> resizable= no, scrollbars=no, toolbar=no,location=no,menubar=no ');")
> End Sub
> and following code in webform2:
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> TextBox1.Text = Request("a").ToString
> End Sub
>
> I could not get the result unless I click on the button1 twice. i know
> what happen in here but have no solution. I will be appreciated if you
> could help here.
> Thanks in advanced,
> Di
>
Thank you for your reply. But actually I tried and this did not work
for some reason, any idea?
Try this onClick event of your button

Response.Write("<SCRIPT>");
Response.Write("window.open('page,aspx?value=" + myval +
"',null,'height=200,width=900,status=yes,toolbar=no ,menubar=no,location=no');
");
Response.Write("</SCRIPT>");

I think this will do the trick, tell me if not

dyw55a@.yahoo.com wrote in message news:<1117647067.875660.133640@.g43g2000cwa.googlegroups. com>...
> Thank you for your reply. But actually I tried and this did not work
> for some reason, any idea?
i'd tried both suggest solutions from Yogi, but it seems not work for me...is any solution yet?

the prob is...webform2's page_load will be run 1st b4 the button_click event run...so any wisdom can help up?

From http://www.developmentnow.com/g/8_2...opup-window.htm

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com

Pass parameters through a hyperlink?

Is it possible to pass parameters through a hyperlink?

For Instance -- HTTP://WWW.MYDOMAIN.COM/PAGE.ASPX?VARIABLE=ABCD

And then if I reference VARIABLE in code, it will be equal to ABCD? If this is not possible directly as I described above, how can it be possible, because I need to somehow pass variables/parameters through a hyperlink.

I know about Session("") already, and that can pass data between pages, I know, but I need to do it through a hyperlink somehow.

Thanks.Sure, you can access it via the QueryString property of the Request object:


string var = Request.QueryString["VARIABLE"];

The string var now has the value of "ABCD".
Thanks a million, works great! :)

Hello

I need to pass parameter through a hyperlink but I don't know how to do this.

I try this in HTML

NavigateUrl="javascript:popup('AddNewContact.aspx?text="+BrokerName+"&BrokerKey="+BrokerID+"',500,700)

It did work.

Can you help me?

THanks,


Guarumal,

What you are doing is different than the original post. His is a static URL and you are building a dynamic URL. This should be a new thread.

My first question is, are BrokerName and BrokerKey VB/C# variables or javascript variables? The most likely situation is that you are trying to build the NavigateURL property in the wrong place. If those are VB/C# variables you need to do this in the code behind page.

Pass Parameters to Dynamically Loaded Control?

I have a page that dynamically loads a control:

Dim RelatedProductsControlAs Control =LoadControl("~/controls/RelatedProducts.ascx")
RelatedProductsPanel.Controls.Add(RelatedProductsControl)

That works perfectly but the problem is I need to set a Public Property in the control. I know you can pass partameters to the control like this:

LoadControl("~/controls/RelatedProducts.asx", Parameters As Object)

But I am not sure how the create the parameter as an object so that I can pass it? Any help would be greatly appreciated.

Thanks,
Max

Hi,

You can set the public properties of the control as:

Dim RelatedProductsControlAs Control = LoadControl("~/controls/RelatedProducts.ascx")
Ctype(RelatedProductsControl,Relatedproducts) 'here i am casting the control to its class
RelatedProductsControl.PropertyXXX = "something" 'now i can access the properties as i have casted it to the control class
RelatedProductsPanel.Controls.Add(RelatedProductsControl)

Hope this helps,

Vivek


I tried what you suggested and changed my code to this:

Dim RelatedProductsControlAs Control = LoadControl("~/controls/RelatedProducts.ascx")
CType(RelatedProductsControl, RelatedProducts)'here i am casting the control to its class
RelatedProductsControl.PricingEmail =True
RelatedProductsPanel.Controls.Add(RelatedProductsControl)

But I get an error 'Type RelatedProducts in not defined'

Surely I am missing something here?


Dim cAs WebUserControl =CType(LoadControl("~/controls/WebUsercontrol.ascx"), WebUserControl)

c.MySkin ="hj"

Now, this will work only if I can "access" the class WebUsercontrol.vb in my page's page_load. In your case it is giving an error because the control is incontrolsfolder, so unless you add a namespace in your page, or move the control outside of the Controls folder (in the same directory as the page), it will give this error.

HTH,

Vivek


BTW: you can avoid this "type XX not find" issue by creating a <%Register %> tag in your aspx page as:

<%@.RegisterSrc="controls/WebUserControl.ascx"TagName="WebUserControl"TagPrefix="uc1" %>

Just write this tag so that the Page is able to find the UserControl's class (since it is not in the same folder as the page).

But this is an issue when you do not know the name of the control to be created, and AFAIK there is no solution to it because the VS 2005 Website model uses multiple assemblies so using wihthout a common namespace. An alternative is to use Web Application project model (old one followed in VS 2003). You can get the same from:

http://weblogs.asp.net/scottgu/archive/2006/04/05/442032.aspx

Hope this helps,

Vivek


Thank You! Thank You! Thank You!

Your last suggestion worked perfectly and worked with my existing file structure - thanks again!

Pass parameters to User Control

Hi

I am using a User Control which is referenced by an ASPX page.

How can I pass a string parameter to the user control, from the base ASPX
page.

Thanks

BenHi Ben,

Create a public method in the usercontrol and access the same from the aspx
page.

Ex:

Code in myusercontrol.ascx.cs
public void PublicMethodInUsercontrol(string valuetopasstocontrol)
{
privatevariable = valuetopasstocontrol;
}

Code in the aspx page.

usercontrolinstance.PublicMethodInUsercontrol("MyValueFromPage");

HTH
Regards
Ashish M Bhonkiya

"Ben" <Ben@.nospam.com> wrote in message
news:u4tZ4ShJEHA.1764@.TK2MSFTNGP12.phx.gbl...
> Hi
> I am using a User Control which is referenced by an ASPX page.
> How can I pass a string parameter to the user control, from the base ASPX
> page.
> Thanks
> Ben
For this purpose I used to create properties (in user control). This way you
can also pass parameters from aspx file (html).
You can access Session to retrieve values. There're plenty of ways. In case
you need some code, I'll try to post.

--
With the best wishes,
Shaul Feldman
"Ben" <Ben@.nospam.com> wrote in message
news:u4tZ4ShJEHA.1764@.TK2MSFTNGP12.phx.gbl...
> Hi
> I am using a User Control which is referenced by an ASPX page.
> How can I pass a string parameter to the user control, from the base ASPX
> page.
> Thanks
> Ben
Sorry for the delay in replying:

I have heard that you can use this method to pass the parameter:

<%@.Register tagprefix="CodeLib" Tagname="usrMain" src="http://pics.10026.com/?src=usrMain.ascx" %
<CodeLib:usrMain bodyData="usrText.ascx" linksPage="NoLinks"
requireSecure="False" runat="server" ID="usrMain"/
But the problem is that I cannot seem to extract the data on the ASCX page

Thanks Ben

"Shaul Feldman" <sfeldman@.writeme.com> wrote in message
news:e$%23BiHkJEHA.3944@.tk2msftngp13.phx.gbl...
> For this purpose I used to create properties (in user control). This way
you
> can also pass parameters from aspx file (html).
> You can access Session to retrieve values. There're plenty of ways. In
case
> you need some code, I'll try to post.
> --
> With the best wishes,
> Shaul Feldman
> "Ben" <Ben@.nospam.com> wrote in message
> news:u4tZ4ShJEHA.1764@.TK2MSFTNGP12.phx.gbl...
> > Hi
> > I am using a User Control which is referenced by an ASPX page.
> > How can I pass a string parameter to the user control, from the base
ASPX
> > page.
> > Thanks
> > Ben
Help! I have an aspx that loads the ascx with parameters in a
placeholder as textboxes. On my postback I can't get the values out
of the textboxes. They are still on the screen so I'm sure they are
there.

I'm having a hard time. I've been told they should just be there.
aspx
ascx
ascxwp

The ascxwp is the user control that holds the textboxes.

I assume someone has figured this out. We have 3 asp programmers and
we are all stumped.

"Shaul Feldman" <sfeldman@.writeme.com> wrote in message news:<e$#BiHkJEHA.3944@.tk2msftngp13.phx.gbl>...
> For this purpose I used to create properties (in user control). This way you
> can also pass parameters from aspx file (html).
> You can access Session to retrieve values. There're plenty of ways. In case
> you need some code, I'll try to post.
> --
> With the best wishes,
> Shaul Feldman
> "Ben" <Ben@.nospam.com> wrote in message
> news:u4tZ4ShJEHA.1764@.TK2MSFTNGP12.phx.gbl...
> > Hi
> > I am using a User Control which is referenced by an ASPX page.
> > How can I pass a string parameter to the user control, from the base ASPX
> > page.
> > Thanks
> > Ben
Implement Properties inside of your UserControl
e.g.

Public Property FirstName() as String
Get
Return txtFirstName.text
End Get
Set (value as String)
txtFirstName.text=value
end set
end property

Then just access the properties
"Lynne K." <ltgaer@.assurity.com> wrote in message
news:7a65e5b4.0405110605.559f0d2d@.posting.google.c om...
> Help! I have an aspx that loads the ascx with parameters in a
> placeholder as textboxes. On my postback I can't get the values out
> of the textboxes. They are still on the screen so I'm sure they are
> there.
> I'm having a hard time. I've been told they should just be there.
> aspx
> ascx
> ascxwp
> The ascxwp is the user control that holds the textboxes.
> I assume someone has figured this out. We have 3 asp programmers and
> we are all stumped.
> "Shaul Feldman" <sfeldman@.writeme.com> wrote in message
news:<e$#BiHkJEHA.3944@.tk2msftngp13.phx.gbl>...
> > For this purpose I used to create properties (in user control). This way
you
> > can also pass parameters from aspx file (html).
> > You can access Session to retrieve values. There're plenty of ways. In
case
> > you need some code, I'll try to post.
> > --
> > With the best wishes,
> > Shaul Feldman
> > "Ben" <Ben@.nospam.com> wrote in message
> > news:u4tZ4ShJEHA.1764@.TK2MSFTNGP12.phx.gbl...
> > > Hi
> > > > I am using a User Control which is referenced by an ASPX page.
> > > > How can I pass a string parameter to the user control, from the base
ASPX
> > > page.
> > > > Thanks
> > > > Ben
> >

Pass Paramter from Repeater - Can't Figure This Out

Hi,
I have a repeater based on a stored procedure. It pulls the following:
catDesc Image
The user sees the category description (catDesc) , and then clicks on
the image (Image) which is bound to the catID. This catID (@dotnet.itags.org.catID --
an integer) is then to be passed to the next page, sculpture2.aspx for
use in a datagrid with a stored procedure.
I understand how to pass a parameter using response.redirect. I've
done so with a dropdownlist in the past by using OnSelectedIndexChanged
and just using dropdownlist.selecteditem.value as the parameter (an
integer in this case) which I use with response.redirect.
Is there an equivalent techinque for using a repeater?
Here is my code:
<asp:repeater runat="server" ID=repeaterOdd>
<itemtemplate>
<p align="left"><%#DataBinder.Eval(Container.DataItem,
"catDesc") %></p>
<p align="left">
<a href="http://links.10026.com/?link=sculpture2.aspx?catDesc=<%#DataBinder.Eval(Container.DataItem,
"catID")%>"
<img src="http://pics.10026.com/?src=<%# DataBinder.Eval(Container.DataItem, "image") %>"></p>
</itemtemplate>
</asp:repeater>
If I pass this parameter as CatID, then I can't retrieve it using a
querysting, and the whole goal is to use a querystring to pass the
parameter. (e.g int passedValue = Request.Querystring["catID"].
Is there some way to pull the selected value of catID out of the
repeater, put it in some kind of variable, and then run a method to
attach it to a response.redirect?
Is there another way to do this? Using a LinkButton?
Thanks in advance.you can replace the image tag with an asp:HyperLink that way the user can
click on the image and be redirected to a page with your catID accesible
thus:
<asp:HyperLink id="HyperLink1" runat="server" ImageUrl="<%#
DataBinder.Eval(Container.DataItem, "image") %>"
NavigateUrl=secondpage.aspx?caiID=<%#DataBinder.Eval(Container.DataItem,
"catID")%>"></asp:HyperLink>
"Ranginald" <davidwank@.gmail.com> wrote in message
news:1146692474.566945.201390@.y43g2000cwc.googlegroups.com...
> Hi,
> I have a repeater based on a stored procedure. It pulls the following:
> catDesc Image
> The user sees the category description (catDesc) , and then clicks on
> the image (Image) which is bound to the catID. This catID (@.catID --
> an integer) is then to be passed to the next page, sculpture2.aspx for
> use in a datagrid with a stored procedure.
> I understand how to pass a parameter using response.redirect. I've
> done so with a dropdownlist in the past by using OnSelectedIndexChanged
> and just using dropdownlist.selecteditem.value as the parameter (an
> integer in this case) which I use with response.redirect.
> Is there an equivalent techinque for using a repeater?
> Here is my code:
> <asp:repeater runat="server" ID=repeaterOdd>
> <itemtemplate>
> <p align="left"><%#DataBinder.Eval(Container.DataItem,
> "catDesc") %></p>
> <p align="left">
> <a href="http://links.10026.com/?link=sculpture2.aspx?catDesc=<%#DataBinder.Eval(Container.DataItem,
> "catID")%>"
> <img src="http://pics.10026.com/?src=<%# DataBinder.Eval(Container.DataItem, "image") %>"></p>
> </itemtemplate>
> </asp:repeater>
> If I pass this parameter as CatID, then I can't retrieve it using a
> querysting, and the whole goal is to use a querystring to pass the
> parameter. (e.g int passedValue = Request.Querystring["catID"].
> Is there some way to pull the selected value of catID out of the
> repeater, put it in some kind of variable, and then run a method to
> attach it to a response.redirect?
> Is there another way to do this? Using a LinkButton?
> Thanks in advance.
>
Thanks for your response. How would I then pull the value?
Still with respons.querystring?
Thanks again.

Pass Paramter from Repeater - Cant Figure This Out

Hi,

I have a repeater based on a stored procedure. It pulls the following:

catDesc Image

The user sees the category description (catDesc) , and then clicks on
the image (Image) which is bound to the catID. This catID (@dotnet.itags.org.catID --
an integer) is then to be passed to the next page, sculpture2.aspx for
use in a datagrid with a stored procedure.

I understand how to pass a parameter using response.redirect. I've
done so with a dropdownlist in the past by using OnSelectedIndexChanged
and just using dropdownlist.selecteditem.value as the parameter (an
integer in this case) which I use with response.redirect.

Is there an equivalent techinque for using a repeater?

Here is my code:

<asp:repeater runat="server" ID=repeaterOdd>
<itemtemplate>
<p align="left"><%#DataBinder.Eval(Container.DataItem,
"catDesc") %></p>
<p align="left">
<a href="http://links.10026.com/?link=sculpture2.aspx?catDesc=<%#DataBinder.Eval(Container.DataItem,
"catID")%>"
<img src="http://pics.10026.com/?src=<%# DataBinder.Eval(Container.DataItem, "image") %>"></p>
</itemtemplate>
</asp:repeater
If I pass this parameter as CatID, then I can't retrieve it using a
querysting, and the whole goal is to use a querystring to pass the
parameter. (e.g int passedValue = Request.Querystring["catID"].

Is there some way to pull the selected value of catID out of the
repeater, put it in some kind of variable, and then run a method to
attach it to a response.redirect?

Is there another way to do this? Using a LinkButton?

Thanks in advance.you can replace the image tag with an asp:HyperLink that way the user can
click on the image and be redirected to a page with your catID accesible
thus:
<asp:HyperLink id="HyperLink1" runat="server" ImageUrl="<%#
DataBinder.Eval(Container.DataItem, "image") %>"
NavigateUrl=secondpage.aspx?caiID=<%#DataBinder.Eval(Container.DataItem,
"catID")%>"></asp:HyperLink
"Ranginald" <davidwank@.gmail.com> wrote in message
news:1146692474.566945.201390@.y43g2000cwc.googlegr oups.com...
> Hi,
> I have a repeater based on a stored procedure. It pulls the following:
> catDesc Image
> The user sees the category description (catDesc) , and then clicks on
> the image (Image) which is bound to the catID. This catID (@.catID --
> an integer) is then to be passed to the next page, sculpture2.aspx for
> use in a datagrid with a stored procedure.
> I understand how to pass a parameter using response.redirect. I've
> done so with a dropdownlist in the past by using OnSelectedIndexChanged
> and just using dropdownlist.selecteditem.value as the parameter (an
> integer in this case) which I use with response.redirect.
> Is there an equivalent techinque for using a repeater?
> Here is my code:
> <asp:repeater runat="server" ID=repeaterOdd>
> <itemtemplate>
> <p align="left"><%#DataBinder.Eval(Container.DataItem,
> "catDesc") %></p>
> <p align="left">
> <a href="http://links.10026.com/?link=sculpture2.aspx?catDesc=<%#DataBinder.Eval(Container.DataItem,
> "catID")%>"
> <img src="http://pics.10026.com/?src=<%# DataBinder.Eval(Container.DataItem, "image") %>"></p>
> </itemtemplate>
> </asp:repeater>
> If I pass this parameter as CatID, then I can't retrieve it using a
> querysting, and the whole goal is to use a querystring to pass the
> parameter. (e.g int passedValue = Request.Querystring["catID"].
> Is there some way to pull the selected value of catID out of the
> repeater, put it in some kind of variable, and then run a method to
> attach it to a response.redirect?
> Is there another way to do this? Using a LinkButton?
> Thanks in advance.
Thanks for your response. How would I then pull the value?
Still with respons.querystring?

Thanks again.