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

[Solved] gridclientselect column

1 Answer 110 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ayesha
Top achievements
Rank 1
Ayesha asked on 14 Dec 2009, 04:55 AM
Hi,

I've a gridclient slect column in my radgrid. when the datasource is null, I bind the grid , bind the datasource to the dattable.
The radgrid displays no records to display which is fine. But the Gridclientselect column in the header (with other columns) is by default checked. I wANT THE HEADER GRIDECLIENTSELCT COLUMN TO BE UNCHECKED WHENTHERE ARE NO ROWS? HOW DO i DO THIS?

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 14 Dec 2009, 10:31 AM
Hello Ayesha,

I could replicate the same issue at my end as well. But probably you can work around this using the following code:
aspx:
<telerik:RadGrid ID="RadGrid1" runat="server" AllowMultiRowSelection="true" OnNeedDataSource="RadGrid1_NeedDataSource" OnItemDataBound="RadGrid1_ItemDataBound">  
    <ClientSettings >  
        <ClientEvents OnGridCreated="GridCreated" />  
        <Selecting AllowRowSelect="true" />         
    </ClientSettings>  
   <MasterTableView>  
     ....  
 
</telerik:RadGrid> 
 
<asp:HiddenField ID="HiddenField1" runat="server" /> 

c#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridHeaderItem) 
        { 
            GridHeaderItem header = (GridHeaderItem)e.Item; 
            string clientid = ((CheckBox)header["ClientSelectColumn"].Controls[0]).ClientID; 
            HiddenField1.Value = clientid; 
        } 
   } 

js:
<script type="text/javascript"
function GridCreated() 
   var hiddenfield = document.getElementById("HiddenField1"); 
   var control = document.getElementById(hiddenfield.value); 
   control.checked = false
 
</script> 

Thanks
Princy.
Tags
Grid
Asked by
Ayesha
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or