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
175
How to get value from textbox in celltemplate
posted

I added a template column to my grid so users can type in a value. In the cell template i put an asp.net textbox. What i want to do is on postback loop through the grid rows and if the user had entered something in the textbox save that information.

 

I can't figure out how to access the textbox data though. The templated cell in my ultragridrow is showing null. Any help appreciated.

 

<igtbl:TemplatedColumn Width="180">
                                    <Header Caption="Enter Value">
                                        <RowLayoutColumnInfo OriginX="5" />
                                    </Header>
                                    <CellTemplate>
                                        <asp:TextBox ID="txtNote" runat="server" Width="170"></asp:TextBox>
                                    </CellTemplate>
                                    <Footer>
                                        <RowLayoutColumnInfo OriginX="5" />
                                    </Footer>
                                </igtbl:TemplatedColumn>

 

 

Parents
No Data
Reply
  • 175
    Verified Answer
    posted

    Nevermind figured it out finally with the help of this post:

     

    http://community.infragistics.com/forums/p/27385/100983.aspx#100983

    Added a key to my template column and used below code.

     

    foreach (UltraGridRow r in grid.Rows)
            {
                TemplatedColumn t = (TemplatedColumn)r.Cells.FromKey("UserInput").Column;
                CellItem c = (CellItem)t.CellItems[0];
                TextBox x = (TextBox)c.FindControl("txtNote");
                if (!string.IsNullOrEmpty(x.Text))
                    test = int.Parse(r.Cells[2].Value.ToString());
            }

Children
No Data