Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
955
How to pass the value of a WebGrid field to the WebDialogWindow
posted

I have a WebGrid that has a "Row_ID" field. The field is a hyperlink. When the user clicks on this field, I want it to open the WebDialogWindow and that WebDialogWindow will have a grid of some sort that is attached to a SQLDataSource that will pull certain information based on the value of the "Row_ID" field from the WebGrid. I'm just not sure how to go about doing this. The Row_ID field does not have to be a hyuperlink...if there is a better way of doing this...but I want the user to know that they can click on the field to see whis other information.

Parents
No Data
Reply
  • 558
    Suggested Answer
    posted

    Hi,

    You can pass the value from WebGrid  as follows:
    (Please note that here I am assuming that WebDialogWindow is on different aspx page)

    Your template control will look like this:
    igtbl:TemplatedColumn Key="LinkButton">
                                <CellTemplate>
                                    <asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click" CommandArgument="<%#Container.Cell.Row.Index%>">LinkButton</asp:LinkButton>
                                </CellTemplate>
                                <Header Caption="LinkButton" Title="">
                                </Header>
    </igtbl:TemplatedColumn>

    Now on your code behind, you use following code inside the click event of the LinkButton control:
    protected void LinkButton1_Click(object sender, EventArgs e)
        {
            LinkButton button = (LinkButton)sender;
            System.Diagnostics.Debug.WriteLine(String.Format("Button Clicked in row {0}", button.CommandArgument.ToString()));
            object value = this.UltraWebGrid1.Rows[int.Parse(button.CommandArgument)].Cells.FromKey("LinkButton").Value;

            Response.Redirect("Default2.aspx?cell=" + value + "");
        }

    On your default2.aspx page(which contains the WebDialogWindow) you can use following code to get the value:
            string cell = Request.QueryString[0];
            //now you can use this value as per your logic

    I hope this will help you.
    Let me know if you have any questions with this matter.

    Neha
    Developer Support Engineer
    Infragistics
    www.infragistics.com/support

Children