Can't get unchanged value of item in rad grid

4 posts, 0 answers
  1. Web Services
    Web Services avatar
    243 posts
    Member since:
    Apr 2008

    Posted 16 Dec 2011 Link to this post

    I have a rad grid and I'm using the pop up window for edit mode. I'm just trying to get the value of every control and update the database. The problem is, if the item has not been changed, the value of the text box is just nothing. I've read through some of your examples, but they seem way over complicated. Is there a simple way to just get the text of the text box within the edit window, whether or not it has been changed? here is my code.

    protected void radgridUpdate(Object source, Telerik.Web.UI.GridCommandEventArgs e)
    {
        RadTextBox track = (RadTextBox)e.Item.FindControl("trackNameInputGrid");
     
     
        Response.Write(track.Text);
    }//radgridUpdate




    <telerik:GridTemplateColumn DataField="trackName" HeaderText="Track Name" SortExpression="trackName"
                            UniqueName="trackName" >
                            <ItemTemplate>
                                <asp:Label ID="trackNameOutput" runat="server" Text='<%# Bind("trackName") %>'></asp:Label>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <telerik:RadTextBox ID="trackNameInputGrid" Runat="server" Value='<%# Eval("trackName") %>' >
                                </telerik:RadTextBox>
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>


  2. Elliott
    Elliott avatar
    391 posts
    Member since:
    May 2010

    Posted 16 Dec 2011 Link to this post

    unless you are doing something funky with attributes or such, try replacing the templated column with a simple GridBoundColumn
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Web Services
    Web Services avatar
    243 posts
    Member since:
    Apr 2008

    Posted 16 Dec 2011 Link to this post

    I changed it to a normal grid bound column and then got the text with this. Thanks

    protected void radgridUpdate(Object source, Telerik.Web.UI.GridCommandEventArgs e)
    {
        int saleFk = obj.getCurrentSale();
     
        GridEditableItem editItem = (GridEditableItem)e.Item;
     
        TextBox track = (TextBox)editItem["trackName"].Controls[0];
     
        if (e.CommandName == "Update")
        {
            Response.Write(track.Text);
        }
        else
        {
     
        }
         
    }//radgridUpdate
  5. Elliott
    Elliott avatar
    391 posts
    Member since:
    May 2010

    Posted 19 Dec 2011 Link to this post

    glad to be of help
Back to Top