Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using the Datagrid HyperLinkColumn 1

Status
Not open for further replies.

NatGreen

Programmer
Apr 19, 2002
90
US
I would like to pass multiple values over the URL to the corresponding page. Here is my code thus far:

<asp:HyperLinkColumn
DataNavigateUrlField=&quot;ID&quot;
DataNavigateUrlFormatString=&quot;javascript:MyPage_window=window.open('MyPage.aspx?ID={0}','MyPage_window','width=700, height=475');Transaction_window.focus()&quot;
DataTextField=&quot;ID&quot;
DataTextFormatString=&quot;View&quot;>
</asp:HyperLinkColumn>

How can I add more Column values to pass over the URL from the datagrid Hyperlink Column?

Thanks in advance
 
Just keep building up the query string like you have so far.
<asp:HyperLinkColumn
DataNavigateUrlField=&quot;ID&quot;
DataNavigateUrlFormatString=&quot;javascript:MyPage_window=window.open('MyPage.aspx?ID={0}&{1}','MyPage_window','width=700, height=475');Transaction_window.focus()&quot;
DataTextField=&quot;ID&quot; DataTextField=&quot;Name&quot;
DataTextFormatString=&quot;View&quot;>
</asp:HyperLinkColumn>



I added in the bolded things, they may not be syntactically correct in your case but you can use something to that affect.

That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
I tried that but I keep getting the following error:

Parser Error Message: The tag contains duplicate 'DataTextField' attributes.

Here is my code:
<asp:HyperLinkColumn
DataNavigateUrlField=&quot;ID&quot; DataNavigateUrlFormatString=&quot;javascript:MyPage_window=window.open('MyPage.aspx?ID={0}&Name={2}','Transaction_window','width=700, height=475');MyPage_window.focus()&quot;
DataTextField=&quot;ID&quot;
DataTextField=&quot;Name&quot;
DataTextFormatString=&quot;View&quot;>
</asp:HyperLinkColumn>



Am I missing something?

Thanks,
NatGreen
 
No no your not. I kinda just took a guess. Now that I look closer at it I can see I was way off.

Change the column to a template column. An do something like so.

<asp:TemplateColumn>
<ItemTemplate>
<asp:HyperLink id=HyperLink1 runat=&quot;server&quot; Text='<%# DataBinder.Eval(Container, &quot;DataItem.Rate&quot;) %>' NavigateUrl='<%# &quot; &quot;DataItem.Rate&quot;)&&quot;&other=&quot;&DataBinder.Eval(Container, &quot;DataItem.SubClassID&quot;) %>'>
</asp:HyperLink>
</ItemTemplate>
</asp:TemplateColumn>


The other thing to do would be to do some code in the itemCreated or ItemDatabound event. Anywhoo hope that helps That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Thanks For your help that works.

~NatGreen
 
hey, that's what I do.. I see a problem and I fix it.

Thnx for the star That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top