Home » Asp.netRSS

List view and hyperlink pass parameters Help

Hi,

 

Anyone know how to resolve the below? I am trying to add a hyperlink to the below listview. This hyperlink passes multiple parameters to the next page? I am trying to achieve the below, works with a gridview but not below.

 

Thanks,

Nijojo

 

 

 <ItemTemplate>
                        <tr >
                            <td>
                                <%#Eval("FirstName")%>
                            </td>
                            <td>
                                <%#Eval("LastName")%>
                            </td>
                            <td>
                                <%#Eval("Location")%>
                            </td>
                            <td>
                                <%#Eval("Department")%>
                            </td>
                            <td style="text-align: center">
                                <asp:CheckBox ID="chkSelect" runat="server" AutoPostBack="true" />
                            </td>
                            <td>

                             <asp:HyperLinkField DataNavigateUrlFields="searchid" 
                    DataNavigateUrlFormatString="details.aspx?searchid={0}" Text="Select" 
                    HeaderText="Description" >
                      </td>


 

 

4 Answers Found

 
 

Answer 2

Not tested. chances are this will work:
<asp:HyperLinkField DataNavigateUrlFields="searchid,somethingelse"   
                   DataNavigateUrlFormatString="details.aspx?searchid={0}&somethingelse={1}" Text="Select"   
                   HeaderText="Description" >
 

Answer 3

nijojo:
I am trying to add a hyperlink to the below listview. This hyperlink passes multiple parameters to the next page?

in the ItemTemplate, use a HyperLink instead of HyperLinkField. 

you set up the url on its NavigateUrl property:

<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# string.Format("details.aspx?searchID={0}", Eval("searchid") ) %>' Text="Select" />


you could add multiple parameters in this convenient format:

NavigateUrl='<%# string.Format("details.aspx?searchID={0}&firstname={1}&lastname={2}", Eval("searchid"), Eval("FirstName"), Eval("LastName") ) %>'



and also add target="_blank" to open in a new window

 

Answer 4

Hey, you can take what SuperGuppie's good advice, or do this:

<td>    

   <a href='<%#string.Format("Search.aspx?id={0}&name={1}……",Eval("Id"),Eval("Name")……)%>'>Click Here……</a>

 </td>  

 

 
 
 

<< Previous      Next >>


Microsoft   |   Windows   |   Visual Studio   |   Follow us on Twitter