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

ClientEvents on Grid Created

3 Answers 198 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dave Hollen
Top achievements
Rank 1
Dave Hollen asked on 11 Feb 2010, 08:45 PM
I am using the OnGridCreated Client event on a radgrid.

I have the following code:

function

 

GridCreated(sender, args)

 

{

 

 

    var scrollArea = sender.GridDataDiv;

 

 

    var dataHeight = sender.get_masterTableView().get_element().clientHeight;

 

}


The problem I am having is that "sender.GridDataDiv" is coming back as NULL.  Sender is not NULL, just Sender.GridDataDiv.  Any ideas why?


Here is my grid markup:

 

<

 

telerik:RadGrid ID="rgUsers" runat="server" AutoGenerateColumns="false" AllowPaging="true" Width="850px" PagerStyle-Mode="NextPrevAndNumeric"

 

 

OnNeedDataSource="rgUsers_NeedDataSource" OnItemCommand="rgUsers_OnItemCommand" OnSelectedIndexChanged="rgUsers_OnSelectedIndexChanged" OnDataBound="rgUsers_OnDataBound"

 

 

 

 

 

 

OnInsertCommand="rgUsers_InsertCommand" OnUpdateCommand="rgUsers_UpdateCommand" ClientSettings-ClientEvents-OnRowCreated="rgUsers_Client_OnRowCreated"

 

 

 

 

 

 

ClientSettings-ClientEvents-OnMasterTableViewCreated="rgUsers_Client_OnMasterTableViewCreated" ClientSettings-ClientEvents-OnGridCreated="GridCreated">

 

 

 

 

 

 

<MasterTableView Width="100%" CommandItemDisplay="Top" InsertItemPageIndexAction="ShowItemOnCurrentPage" DataKeyNames="GlobalId" ClientDataKeyNames="GlobalId">

 

 

 

 

 

 

<CommandItemSettings AddNewRecordText="Add User..." />

 

 

 

 

 

 

<Columns>

 

 

 

 

 

 

<telerik:GridTemplateColumn UniqueName="SelectUserColumn" >

 

 

 

 

 

 

<ItemTemplate>

 

 

 

 

 

 

<asp:CheckBox runat="server" ID="cbSelectUser" onclick="cbSelectUser_OnClick();" />

 

 

 

 

 

 

</ItemTemplate>

 

 

 

 

 

 

</telerik:GridTemplateColumn>

 

 

 

 

 

 

<telerik:GridEditCommandColumn ButtonType="ImageButton" />

 

 

 

 

 

 

<telerik:GridBoundColumn DataField="GlobalId" UniqueName="GlobalIdColumn" Visible="false" ReadOnly="true" />

 

 

 

 

 

 

<telerik:GridTemplateColumn DataField="Username" UniqueName="UsernameColumn" HeaderText="Username" >

 

 

 

 

 

 

<ItemTemplate>

 

 

 

 

 

 

<asp:LinkButton ID="btnUserDetails" runat="server" CommandName="Select" CommandArgument='<%# Eval("GlobalId") %>' Text='<%# Eval("Username") %>' />

 

 

 

 

 

 

</ItemTemplate>

 

 

 

 

 

 

<EditItemTemplate>

 

 

 

 

 

 

<asp:TextBox ID="txtUsername" runat="server" Text='<%# Eval("Username") %>' />

 

 

 

 

 

 

</EditItemTemplate>

 

 

 

 

 

 

</telerik:GridTemplateColumn>

 

 

 

 

 

 

<telerik:GridCheckBoxColumn DataField="StrongPassword" HeaderText="Strong Password" UniqueName="StrongPasswordColumn" />

 

 

 

 

 

 

<telerik:GridCheckBoxColumn DataField="PasswordExpires" HeaderText="Password Expires" UniqueName="PasswordExpiresColumn" />

 

 

 

 

 

 

<telerik:GridBoundColumn DataField="PasswordValidDays" HeaderText="Password Valid # Days" UniqueName="PasswordValidDaysColulmn" />

 

 

 

 

 

 

<telerik:GridDropDownColumn DataField="RoleId" DataSourceID="LinqRoleSource" HeaderText="Role" ListTextField="RoleName" ListValueField="RoleId" UniqueName="RoleColumn" />

 

 

 

 

 

 

<telerik:GridBoundColumn DataField="Person.FirstName" HeaderText="First Name" UniqueName="FirstNameColumn" />

 

 

 

 

 

 

<telerik:GridBoundColumn DataField="Person.LastName" HeaderText="Last Name" UniqueName="LastNameColumn" />

 

 

 

 

 

 

<telerik:GridDropDownColumn DataField="OrganizationId" DataSourceID="LinqOrgSource" UniqueName="OfficeColumn" HeaderText="Office" ListTextField="Name" ListValueField="OrganizationId" />

 

 

 

 

 

 

<telerik:GridBoundColumn DataField="OrganizationId" UniqueName="OrgIDColumn" Visible="true" />

 

 

 

 

 

 

</Columns>

 

 

 

 

 

 

<EditFormSettings EditColumn-ButtonType="ImageButton" EditColumn-UniqueName="EditColumn" UserControlName="~/UserControls/Users/EditUserDetails.ascx" EditFormType="WebUserControl" />

 

 

 

 

 

 

</MasterTableView>

 


</

 

telerik:RadGrid>

 



Thanks

3 Answers, 1 is accepted

Sort by
0
Dave Hollen
Top achievements
Rank 1
answered on 11 Feb 2010, 08:52 PM
never mind - fixed.
0
Jones
Top achievements
Rank 1
answered on 29 Apr 2010, 01:33 PM
Hi Dave

Can you tell me what you did to fix the problem?  I'm facing a similar one.
0
Dave Hollen
Top achievements
Rank 1
answered on 29 Apr 2010, 01:48 PM
My script is currently attached to the OnGridCreated Client Event, and everything seems to be working fine.  I placed a check to make sure the value being returned from GridDataDiv is not NULL and have not had any problems with my script. 
Tags
Grid
Asked by
Dave Hollen
Top achievements
Rank 1
Answers by
Dave Hollen
Top achievements
Rank 1
Jones
Top achievements
Rank 1
Share this question
or