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

CheckBox edit mode linked to a field

2 Answers 56 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Myriam
Top achievements
Rank 1
Myriam asked on 30 Sep 2008, 06:21 PM
Hello
I have a radgrid with a detail table.
In that detail table I have a checkbox linked to a field in my sqldatasource linked to my radgrid.
I would like to be able to update that checkbox. I don't want to have to click somewhere to be able to edit it. I always want it in edit mode. And I want to edit ONLY that field even if I have other fields linked to my sqldatasource on the same row. I want them to stay readonly.
Is it possible to do something like that?
Thanks in advance
I really appreciate your help!

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 01 Oct 2008, 04:42 AM
Hi Myriam,

Set the ReadOnly property for rest of th columns to true. Try the following code snippet to set detail table in edit mode on expanding.

CS:
 protected void RadGrid1_PreRender(object sender, EventArgs e) 
    { 
        foreach (GridDataItem item in RadGrid1.MasterTableView.Items) 
        { 
            if (item.Expanded) 
            { 
 
                GridTableView nestedView = ((GridDataItem)item).ChildItem.NestedTableViews[0]; 
                foreach (GridItem childitem in nestedView.Items) 
                { 
                    childitem.Edit = true
                } 
                nestedView.Rebind(); 
            } 
        }  
    } 
 


Thanks
Shinu
0
Myriam
Top achievements
Rank 1
answered on 01 Oct 2008, 12:44 PM
Shinu
Thanks for the help.
Finally I changed the way to do that.
I put a checkbox a checkbox like this

<

telerik:GridTemplateColumn UniqueName="TemplateColumn" HeaderText="Highlight <br/> ship name">

<ItemTemplate>

<asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="true" OnCheckedChanged="CheckedChanged" />

</ItemTemplate>

</telerik:GridTemplateColumn>
and when the user will click on it, I will go update the database.
I just have to find how to fired my even checkedchanged as I have problem with it. (but I post on another thread about that)
Thanks anyway!

Tags
Grid
Asked by
Myriam
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Myriam
Top achievements
Rank 1
Share this question
or