Tuesday, June 9, 2009

How do I specify more than one parameter for my HyperlinkColumn?

How do I specify more than one parameter for my HyperlinkColumn?
Many times will developing the applications we come accross the thing that how i can pass more then one parameter in the query string which is genertated by the datagrid or gridviews... once i was developing an application and the same problem came accross at that time i was quite new to ASP.net and was stucked there did lots of googleing and found the answer now today i want to share that piece of code as an example may be i may help you to avoid a bit burdden of yours to find the code

Here i have encoded the querstring or the URL to avoid some unwanted error which are normaly genertaed due to spaces and special characters.
the code follows like

< asp:DataGrid id="DataGrid1" runat="server" AutoGenerateColumns="False" >
< Columns >
< asp:TemplateColumn HeaderText="Sample Column" >
< ItemTemplate >
< asp:Hyperlink runat="server" Text=' < %#Container.DataItem("TextVal")% >' NavigateUrl=' < %# "page.aspx?Param1=" & Server.UrlEncode(Container.DataItem("Val1")) & "&Param2=" & Server.UrlEncode(Container.DataItem("Val2"))%>'/>
</itemtemplate >
</asp:TemplateColumn >
</columns >

Thanks and regards
Meetu Choudhary

No comments:

Post a Comment

Subscribe via email

Enter your email address:

Delivered by FeedBurner


MSDotnetMentor My Website http://msdotnetmentor.com