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

[Solved] Cannot select GridClientSelectColumn from code behind

3 Answers 113 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Inessa Parfjonova
Top achievements
Rank 1
Inessa Parfjonova asked on 04 Mar 2010, 12:11 PM
I cannot select GridClienteSelectColumn from code.

I do it in ItemDataBind function.

 protected void dgCategorie_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        if (e.Item.ItemType != GridItemType.Item && e.Item.ItemType != GridItemType.AlternatingItem)
            return;

        GridDataItem item = (GridDataItem)e.Item; 

        switch (e.Item.OwnerTableView.Name)
        {
            case "categorie":

                 
                var chkAutoriz = (CheckBox)item["ClientSelectColumn"].Controls[0];
                chkAutoriz.Checked = (item["AutorizTuttoCat"].Text == "True") ? true : false;
                break;

            case "analisi" :

                var chkAutorizSottoCat = (CheckBox)item["ClientSelectColumnSotto"].Controls[0];
                chkAutorizSottoCat.Checked = (item["Autoriz"].Text == "True") ? true : false;
                break;
        }

      
    }
Thanks.

3 Answers, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 04 Mar 2010, 01:03 PM
Hi Inessa ,

Try using item.Selected = true instead of setting the check mark on the client select box.

I hope this helps.

Regards,
Tsvetoslav
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.
0
Inessa Parfjonova
Top achievements
Rank 1
answered on 04 Mar 2010, 01:21 PM
I tried but I have the error. Could you give me the code starting from my example.

Inessa
0
Tsvetoslav
Telerik team
answered on 05 Mar 2010, 12:51 PM
Hello Inessa,

Attached is a small sample demonstrating row selection through code-behind.

Best wishes,
Tsvetoslav
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
Inessa Parfjonova
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Inessa Parfjonova
Top achievements
Rank 1
Share this question
or