views:

561

answers:

3

I am not able to sent the value of the MachineID to another page using the hyperlink in gridview.

<!-- <asp:TemplateField HeaderText="FailedFiles" 
                SortExpression="NumFailedFilesOverSLA">
                <ItemTemplate>
                    <asp:HyperLink ID="HyperLink1" runat="server"  Text='<%#Bind("NumFailedFilesOverSLA") %>'></asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>

I have tried putting

DataNavigateUrlFields="MachineID" DataNavigateUrlFormatString="GetFilesFailed.aspx?id={0}"

but dont know why this is not working??

Please suggest... thanks

A: 

If this doesn't work, then check that you are actually getting a value back from the DB for MachineID:

<asp:HyperLink ID="HyperLink1" Text='<%# Bind("NumFailedFilesOverSLA") %>' 
    runat="server" DataNavigateUrlFields="MachineID" 
        DataNavigateUrlFormatString="GetFilesFailed.aspx?id={0}">
</asp:HyperLink>
IrishChieftain
see the gridview is getting populated by the machineid so that means i am getting the value from DB
Can you provide the code from the destination page, where you are retrieving the param value?
IrishChieftain
string strID = Request.QueryString["id"];
A: 

First, try to put the default gridview in the page and attach it to the data source, so you can test if there is data to display.

If you are assigning the data source from code behind don't forget to call the DataBind() method after that.

Wagner
the data is getting displayed... but the problem is DataNavigateUrlFormatString is not working and NavigateUrl is working... so if i use navigateurl then it is navigating to the new page but the values are not passing...
+1  A: 
 <ItemTemplate>
 <asp:HyperLink ID="HyperLink1" runat="server" 
 NavigateUrl='<%# Eval("Inventory_ID", "/default.aspx?ID={0}") %>'
                    Text="Details"></asp:HyperLink>
  </ItemTemplate>

This should solve your problem. This is exactly how I used it.

Jordan Johnson