This is a migrated thread and some comments may be shown as answers.

Can't get unchanged value of item in rad grid

3 Answers 64 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Web Services
Top achievements
Rank 2
Web Services asked on 16 Dec 2011, 08:27 PM
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>


3 Answers, 1 is accepted

Sort by
0
Elliott
Top achievements
Rank 2
answered on 16 Dec 2011, 08:50 PM
unless you are doing something funky with attributes or such, try replacing the templated column with a simple GridBoundColumn
0
Web Services
Top achievements
Rank 2
answered on 16 Dec 2011, 10:37 PM
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
0
Elliott
Top achievements
Rank 2
answered on 19 Dec 2011, 10:21 PM
glad to be of help
Tags
Grid
Asked by
Web Services
Top achievements
Rank 2
Answers by
Elliott
Top achievements
Rank 2
Web Services
Top achievements
Rank 2
Share this question
or