Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
Hi,
In my Web Form I have three drop down column , one label, one add button and a gridview .
On my gridview I have a hyperlink column.
On clicking that hyperlink column I have to redirected to next web form with value of that row’s all 4 above said column on 4 label's .
How this will be implement in c#
Please Help.
Thanks
Posted 23-Nov-12 1:09am
Comments
ChandraShekar.SK at 23-Nov-12 6:19am
   
Try if this works..
Session["Value1"] = gridView.Rows[e.RowIndex].Cells[1].Text;
 
and retrieve the value on the other page like.
String value1 = Session["Value1"].ToString();
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

refer the following code
 
<asp:GridView ID="grvTest" runat="server" AutoGenerateColumns="false"
    onrowcommand="grvTest_RowCommand">
    <Columns>
        <asp:BoundField DataField="Name" HeaderText="Name" />
        <asp:TemplateField>
            <ItemTemplate>
                <asp:LinkButton ID="lnkTest" runat="server" Text="Move"       CommandName="Move"></asp:LinkButton>
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>
 

protected void grvTest_RowCommand(object sender, GridViewCommandEventArgs e)
        {
          if (e.CommandName == "Move")
          {
           GridViewRow row=(GridViewRow)((LinkButton)e.CommandSource).NamingContainer;
           string name = row.Cells[0].Text;
           Response.Redirect("Page2.aspx?name=" + name);
          }
        }
 
collect all grid cell values and form the url as given above
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Here's an example for you to pass the value to other webform through query string
 
<asp:TemplateField HeaderText="Document ID" HeaderStyle-CssClass="gridheaderleft"
                                        ItemStyle-CssClass="boundfield" HeaderStyle-Width="100px">
                                        <ItemTemplate>
                                            <asp:HyperLink ID="hyperDocketDetails" Text='<%# bind("ClientDocumentIdentifier") %>'
                                                runat="server" NavigateUrl='<%# "DocumentDetails.aspx?id="+ DataBinder.Eval(Container.DataItem,"ID") +"&moduleid="+ Request["moduleid"] + "&retURL=" + HttpUtility.UrlEncode(Request.Path + "?" + Request.QueryString) %>' />
                                            <asp:Label ID="lblDocket" Text='<%# bind("ClientDocumentIdentifier") %>' runat="server" />
                                        </ItemTemplate>
                                    </asp:TemplateField>

 
Hope it helps
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Hi,
 
First of all try to locate GridViewRow(Track which row is clicked using LinkButton).
 
Then find all the desired control using GridView.Rows[index].FindControl("ControlID").
 
Cast control into appropriate tyle like "DropDown","Label" etc...
 
then using Response.Redirect(url), you can redirect as per your requirement.
 
Regards,
Dharmesh
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 325
1 DamithSL 300
2 Sergey Alexandrovich Kryukov 289
3 CPallini 235
4 Maciej Los 215
0 OriginalGriff 5,455
1 DamithSL 4,422
2 Maciej Los 3,860
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,010


Advertise | Privacy | Mobile
Web04 | 2.8.141216.1 | Last Updated 23 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100