Hi,
asp.net code
using datagrid, column1 is my hyperlink and column2 is the database value.
Column1 Column2
View Info anm
Q: How can I get the result from my hyperlink that should be like this "name.aspx?nme=asp".
Thanks
Printable View
Hi,
asp.net code
using datagrid, column1 is my hyperlink and column2 is the database value.
Column1 Column2
View Info anm
Q: How can I get the result from my hyperlink that should be like this "name.aspx?nme=asp".
Thanks
you would set up the hyperlink column something like this:
VB Code:
<asp:HyperLinkColumn HeaderText="Column1" DataNavigateUrlField="name" DataNavigateUrlFormatString="name.aspx?name={0}" Text="View Info" />
where DataNavigateUrlField is the field in the datasource which will provide the URL of the page. So if you have a unique ID field in the datasource called 'ID' you would put DataNavigateUrlField="ID" if you have a field called name which is unique then substitute name for ID.
Thanks Bro!
Quote:
Originally Posted by basilisk
Basilisk,
thanks for your reply...
Q: how about adding a value of textbox in HyperLinkColumn? 2 fields?
DataNavigateUrlFormatString="name.aspx?name={0}&xcde=???"
having two fields in the hyperlink column is rather more difficult and the only way i have got this to work is to use a templatecolumn instead of a hyperlink column and then put the asp:hyperlink inside it like so:
VB Code:
<asp:templatecolumn HeaderText="Details" Visible="true"> <itemtemplate> <asp:HyperLink id="HyperLink1" runat="server" Text="View Info" NavigateUrl='<%# "name.aspx?" + DataBinder.Eval(Container.DataItem,"fieldname1","name={0}") + "&" +DataBinder.Eval(Container.DataItem,"fieldname2","xcde={0}")%>'> </asp:HyperLink> </itemtemplate> </asp:templatecolumn>
you will need to substitute the fieldnames/column names of your datatable that you need picked up for fieldname1 and fieldname2.
This will then give you a URL of this format:
name.aspx?name=xxxx&xcde=yyyyy
Basilisk,
thanks again!!!