You must Sign In to post a response.
  • Category: .NET

    Sending multiple querystring from a datagridview on a Hyperlinkfield

    Hello everyone

    Please help me with the following

    This is my code

    Basically I want to send InstituteID & Percent as C_Percent to the next page.

    <asp:GridView ID="dgvDeliveryReport" runat="server" AutoGenerateColumns="False"
    Width="100%" Height="27px" Font-Names="Tahoma" Font-Size="Smaller"
    onselectedindexchanged="dgvDeliveryReport_SelectedIndexChanged">
    <RowStyle BorderColor="#CCFF99" />
    <Columns>
    <asp:CommandField ShowSelectButton="True" HeaderText="View" SelectText="View" >
    <ItemStyle Width="35px" />
    </asp:CommandField>
    <asp:BoundField DataField="InstituteID" HeaderText="REF No" >
    <HeaderStyle ForeColor="White" />
    <ItemStyle HorizontalAlign="Center" />
    </asp:BoundField>
    <asp:BoundField DataField="Institutename" HeaderText="NAME" >
    <HeaderStyle ForeColor="White" />
    <ItemStyle HorizontalAlign="Center" />
    </asp:BoundField>
    <asp:BoundField DataField="O_QTY" HeaderText="ORDER QTY" >
    <HeaderStyle ForeColor="White" />
    <ItemStyle HorizontalAlign="Center" />
    </asp:BoundField>
    <asp:BoundField DataField="TotalPrice" HeaderText="ORDER PRICE">
    <HeaderStyle ForeColor="White" />
    </asp:BoundField>
    <asp:BoundField DataField="D_QTY" HeaderText="DELIVERED QTY" >
    <HeaderStyle ForeColor="White" />
    <ItemStyle HorizontalAlign="Center" />
    </asp:BoundField>
    <asp:BoundField DataField="D_Percent" HeaderText="DELIVERY %" >
    <HeaderStyle ForeColor="White" />
    <ItemStyle HorizontalAlign="Center" />
    </asp:BoundField>
    <asp:BoundField DataField="C_Percent" HeaderText="CONFIRMED %" >
    <HeaderStyle ForeColor="White" />
    <ItemStyle HorizontalAlign="Center" />
    </asp:BoundField>
    <asp:HyperLinkField DataNavigateUrlFields="InstituteID"
    DataNavigateUrlFormatString="PrintConsolidations.aspx?InstituteID={0}&Percent="
    DataTextField="InstituteID" HeaderText="Print"
    NavigateUrl="~/PrintConsolidations.aspx" DataTextFormatString="Print"
    Text="Print" />
    </Columns>
    <HeaderStyle BackColor="#996633" />
    <AlternatingRowStyle BackColor="#CCCCCC" BorderColor="#999999"
    BorderStyle="None" />
    </asp:GridView>

    Hope U understand what I mean
    Thanx in advance
  • #769545
    Hi Samuel,

    Rather than using the bound field method use the template and define all the columns with normal HTML control itself. To bind the value you have to use '<%# Eval("columnname") %>


    If we use that method, then we can pass any number of parameter while clicking an url,
    <a href='<%# "PrintConsolidations.aspx?InstituteID="+Eval("InstituteID").ToString()+"&Percent="+Eval("C_Percent").ToString() %>'>Click</a>


    Let me know if you have any questions.

    Regards,
    V.M. Damodharan
    "Your talent will be worthless, when you have fear and tension."


  • Sign In to post your comments