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

Only the editable Checkbox

3 Answers 45 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rudá Cunha
Top achievements
Rank 2
Rudá Cunha asked on 27 Sep 2010, 10:18 PM
I have a grid that has a checkbox column, and I need that it is always editable, select or clear when performing a postback to update the database. Tb need only checkbox is editable!

How can I do this?

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 28 Sep 2010, 05:41 AM
Hello Ruda,

Please refer the following forum post which explains the same scenario.
checkbox within radgrid


-Shinu.
0
Rudá Cunha
Top achievements
Rank 2
answered on 28 Sep 2010, 02:12 PM
It was not what I wanted!

I'll try to explain, I need to create a checkbox that is editable and when you run the command dial ItemCommand!

How will I use in several grid, I thought I would create a CustomColumn.


public class GridCheckBoxColumnCommand : GridButtonColumn
{
    public GridCheckBoxColumnCommand()
        : base() { }
 
    public override void InitializeCell(TableCell cell, int columnIndex, GridItem inItem)
    {
        if (inItem is GridDataItem)
        {
            CheckBox cb = new CheckBox();
            cb.ID = "CheckBoxCommand";
            cell.Controls.Add(cb);
 
            cb.Attributes.Add("onclick", inItem.Page.ClientScript.GetPostBackEventReference(cb, ""));
        }
        else
            base.InitializeCell(cell, columnIndex, inItem);
    }
}

<telerik:RadGrid OnItemCommand="RadGrid1_ItemCommand" ...>
    <MasterTableView>
        <Columns>
            <cc1:GridCheckBoxColumnCommand CommandName="test"         DataTextField="Retorno" >
            </cc1:GridCheckBoxColumnCommand>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

He's not a postback but the event runs ItemCommand!

And also how do I get the value of the DataTextField and put the checkbox?
0
Mira
Telerik team
answered on 01 Oct 2010, 12:29 PM
Hello Rudá,

I have followed your scenario and prepared a sample project for you demonstrating how the desired functionality can be implemented. You can find it attached to this message.

I hope it helps.

Sincerely yours,
Mira
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Rudá Cunha
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Rudá Cunha
Top achievements
Rank 2
Mira
Telerik team
Share this question
or