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

Radgrid Editors not working

3 Answers 76 Views
Grid
This is a migrated thread and some comments may be shown as answers.
pgodard
Top achievements
Rank 1
pgodard asked on 10 Nov 2010, 02:47 AM

My radgrid editors are not working when Radgrid is on a user control that's loaded dynamically. I tested the code on a Radgrid that's loaded from a normal page it works without any problem but would not would when loaded from user control. here is the code:

 

<%

@ Control Language="VB" AutoEventWireup="false" CodeFile="Licenses.ascx.vb" Inherits="Prospects_Content_Licenses" %>

 

<%

@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>

 

 

<telerik:RadGrid ID="RadGrid1" runat="server" AllowMultiRowSelection="True"

 

 

 

 

 

Skin="Vista" AllowAutomaticDeletes="True"

 

 

AllowAutomaticInserts="True" Width="800px" PageSize="100" AllowAutomaticUpdates="True"

 

 

 

 

 

AllowPaging="True" OnItemUpdated="Radgrid1_ItemUpdated" OnItemDeleted="Radgrid1_ItemDeleted"

 

 

 

 

 

OnItemInserted="Radgrid1_ItemInserted"

 

 

 

 

 

DataSourceID="EmployeeLicensesListDS" GridLines="None">

 

 

 

 

 

<MasterTableView autogeneratecolumns="False" datakeynames="EmployeeID,LicenseListID" CommandItemDisplay="Top"

 

 

datasourceid="EmployeeLicensesListDS">

 

 

 

 

 

<RowIndicatorColumn>

 

 

 

 

 

<HeaderStyle Width="20px"></HeaderStyle>

 

 

 

 

 

</RowIndicatorColumn>

 

 

 

 

 

<ExpandCollapseColumn>

 

 

 

 

 

<HeaderStyle Width="20px"></HeaderStyle>

 

 

 

 

 

</ExpandCollapseColumn>

 

 

 

 

 

<Columns>

 

 

 

 

 

<telerik:GridEditCommandColumn ButtonType="ImageButton"

 

 

CancelImageUrl="../../Img/Cancel.gif" EditImageUrl="../../Img/Edit.gif"

 

 

InsertImageUrl="../../Img/Insert.gif" UpdateImageUrl="../../Img/Update.gif">

 

 

 

 

 

<HeaderStyle Width="20px" />

 

 

 

 

 

</telerik:GridEditCommandColumn>

 

 

 

 

 

 

<telerik:GridBoundColumn DataField="EmployeeID" DataType="System.Int32" visible="false"

 

 

HeaderText="EmployeeID" SortExpression="EmployeeID" UniqueName="EmployeeID" ReadOnly="True" >

 

 

 

 

 

</telerik:GridBoundColumn>

 

 

 

 

 

<telerik:GridBoundColumn DataField="LicenseListID" DataType="System.Int32" visible="false"

 

 

 

 

 

HeaderText="LicenseListID" ReadOnly="True" SortExpression="LicenseListID"

 

 

UniqueName="LicenseListID">

 

 

 

 

 

</telerik:GridBoundColumn>

 

 

 

 

 

<telerik:GridBoundColumn DataField="Description"

 

 

HeaderText="License Description" SortExpression="Description" UniqueName="Description">

 

 

 

 

 

</telerik:GridBoundColumn>

 

 

 

 

 

 

<telerik:GridDropDownColumn DataField="LicenseState"

 

 

HeaderText="License State" SortExpression="LicenseState" DropDownControlType="RadComboBox"

 

 

 

 

 

DataSourceID="tblStateDS" ListValueField="StateCode" ListTextField="StateName"

 

 

 

 

 

UniqueName="LicenseState">

 

 

 

 

 

</telerik:GridDropDownColumn>

 

 

<telerik:GridBoundColumn DataField="LicenseCategoryIDDescription"

 

 

HeaderText="License Category Description" SortExpression="LicenseCategoryIDDescription" UniqueName="LicenseCategoryIDDescription">

 

 

 

 

 

</telerik:GridBoundColumn>

 

 

 

 

 

<telerik:GridBoundColumn DataField="LicenseID"

 

 

HeaderText="License ID" SortExpression="LicenseID" UniqueName="LicenseID">

 

 

 

 

 

</telerik:GridBoundColumn>

 

 

 

 

 

 

<telerik:GridDropDownColumn DataField="LicenseStatus"

 

 

HeaderText="License Status" SortExpression="LicenseStatus" DropDownControlType="RadComboBox"

 

 

 

 

 

DataSourceID="tblStatusDS" ListValueField="StatusID" ListTextField="Description"

 

 

 

 

 

UniqueName="LicenseStatus">

 

 

 

 

 

</telerik:GridDropDownColumn>

 

 

<telerik:GridDateTimeColumn DataField="ExpirationDate" DataType="System.DateTime" PickerType="DatePicker"

 

 

 

 

 

HeaderText="License Expiration Date" ReadOnly="False" SortExpression="ExpirationDate"

 

 

UniqueName="ExpirationDate" DataFormatString="{0:d}">

 

 

</telerik:GridDateTimeColumn>

 

 

 

 

 

 

 

<telerik:GridBoundColumn DataField="AddedBy" HeaderText="Added By"

 

 

ReadOnly="True" SortExpression="AddedBy" UniqueName="AddedBy">

 

 

 

 

 

</telerik:GridBoundColumn>

 

 

 

 

 

<telerik:GridBoundColumn DataField="DateAdded" DataType="System.DateTime"

 

 

HeaderText="Date Added" ReadOnly="True" SortExpression="DateAdded"

 

 

UniqueName="DateAdded" DataFormatString="{0:d}">

 

 

 

 

 

</telerik:GridBoundColumn>

 

 

 

 

 

<telerik:GridBoundColumn DataField="LastUpdatedBy" HeaderText="Last Updated By"

 

 

ReadOnly="True" SortExpression="LastUpdatedBy" UniqueName="LastUpdatedBy">

 

 

 

 

 

</telerik:GridBoundColumn>

 

 

 

 

 

<telerik:GridBoundColumn DataField="LastUpdatedDate" DataType="System.DateTime"

 

 

HeaderText="Last Updated Date" ReadOnly="True" SortExpression="LastUpdatedDate"

 

 

UniqueName="LastUpdatedDate" DataFormatString="{0:d}">

 

 

 

 

 

</telerik:GridBoundColumn>

 

 

 

 

 

 

</Columns>

 

 

 

 

 

<CommandItemSettings AddNewRecordText="Add License" />

 

 

 

 

 

<EditFormSettings CaptionDataField="LicenseListID"

 

 

CaptionFormatString="Edit Properties of License ID: {0}" ColumnNumber="3">

 

 

 

 

 

<FormTableItemStyle Wrap="False" />

 

 

 

 

 

<FormMainTableStyle BackColor="White" CellPadding="3" CellSpacing="0" BorderColor="Aquamarine" BorderWidth="2px"

 

 

 

 

 

GridLines="Horizontal" />

 

 

 

 

 

<FormCaptionStyle Font-Bold="True" Font-Size="Small" HorizontalAlign="Center" />

 

 

 

 

 

<FormTableStyle BackColor="White" CellPadding="2" CellSpacing="0"

 

 

Height="110px" Width="210px" />

 

 

 

 

 

<FormTableAlternatingItemStyle Wrap="False" />

 

 

 

 

 

<FormStyle Width="1%" />

 

 

 

 

 

<EditColumn ButtonType="ImageButton" CancelImageUrl="../../Img/Cancel.gif"

 

 

CancelText="Cancel edit" EditImageUrl="../../Img/Edit.gif"

 

 

InsertImageUrl="../../Img/Insert.gif" InsertText="Insert License"

 

 

UniqueName="EditCommandColumn1" UpdateImageUrl="../../Img/Update.gif"

 

 

UpdateText="Update License">

 

 

 

 

 

</EditColumn>

 

 

 

 

 

<FormTableButtonRowStyle HorizontalAlign="Right" />

 

 

 

 

 

<PopUpSettings ScrollBars="None" />

 

 

 

 

 

</EditFormSettings>

 

 

 

 

 

</MasterTableView>

 

 

 

 

 

<FilterMenu EnableTheming="True">

 

 

 

 

 

<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>

 

 

 

 

 

</FilterMenu>

 

 

 

 

 

</telerik:RadGrid>

 

 

 

 

 

<asp:SqlDataSource ID="EmployeeLicensesListDS" runat="server" OnInserting="setDefaultColumns" OnUpdating="setDefaultColumns"

 

 

ConnectionString="<%$ ConnectionStrings:HRSOCSSQLConnectionString %>"

 

 

InsertCommand="INSERT INTO EmployeeLicensesList([CompanyID], [EmployeeID], [SSN], [LicenseStatus], [AddedBy], [LastUpdatedBy]) VALUES (@CompanyID, @EmployeeID, @SSN, @LicenseStatus, @AddedBy, @LastUpdatedBy)"

 

 

SelectCommand="SELECT a.CompanyID, a.SSN, a.EmployeeID, a.LicenseStatus, a.ExpirationDate, a.LicenseState, a.LicenseID, a.AddedBy, a.DateAdded, a.LastUpdatedBy,

 

a.LastUpdatedDate, b.LicenseCategoryID, b.Description, b.LicenseListID FROM EmployeeLicensesList AS a RIGHT OUTER JOIN LicensesList AS b ON a.LicenseListID = b.LicenseListID WHERE (a.employeeid=@employeeid) OR (a.employeeid is null)"

 

 

 

UpdateCommand="UPDATE EmployeeLicensesList SET EmployeeID = @EmployeeID, LicenseStatus = @LicenseStatus, LastUpdatedBy = @LastUpdatedBy, LastUpdatedDate = getdate() WHERE (EmployeeID = @EmployeeID) AND (LicenseListID = @LicenseListID)">

 

 

 

 

 

<SelectParameters>

 

 

 

 

 

<asp:Parameter Name="EmployeeID" Type="Int64" />

 

 

 

 

 

<asp:Parameter Name="SSN" Type="String" />

 

 

 

 

 

</SelectParameters>

 

 

 

 

 

<UpdateParameters>

 

 

 

 

 

<asp:Parameter Name="CompanyID" Type="Int32" />

 

 

 

 

 

<asp:Parameter Name="EmployeeID" Type="Int32" />

 

 

 

 

 

<asp:Parameter Name="SSN" Type="String" />

 

 

<asp:Parameter Name="LicenseListID" Type="Int32" />

 

 

<asp:Parameter Name="LicenseStatus" Type="String" />

 

 

<asp:SessionParameter Name="AddedBy" SessionField="UserID" type="String" />

 

 

 

 

 

<asp:SessionParameter Name="LastUpdatedBy" SessionField="UserID" type="String" />

 

 

 

 

 

</UpdateParameters>

 

 

 

 

 

<InsertParameters>

 

 

 

 

 

<asp:Parameter Name="CompanyID" Type="Int32" />

 

 

 

 

 

<asp:Parameter Name="EmployeeID" Type="Int32" />

 

 

 

 

 

<asp:Parameter Name="SSN" Type="String" />

 

 

<asp:Parameter Name="LicenseListID" Type="Int32" />

 

 

<asp:Parameter Name="LicenseStatus" Type="String" />

 

 

<asp:SessionParameter Name="AddedBy" SessionField="UserID" type="String" />

 

 

 

 

 

<asp:SessionParameter Name="LastUpdatedBy" SessionField="UserID" type="String" />

 

 

 

 

 

</InsertParameters>

 

 

 

 

 

</asp:SqlDataSource>

 

 

 

 

 

<asp:SqlDataSource ID="tblStateDS" runat="server" ConnectionString="<%$ ConnectionStrings:HRSOSYS01ConnectionString %>"

 

 

SelectCommand="SELECT [StateCode], [StateName] FROM [tblState]">

 

</

 

asp:SqlDataSource>

 

 

 

 

 

<asp:SqlDataSource ID="tblStateDS0" runat="server" ConnectionString="<%$ ConnectionStrings:HRSOSYS01ConnectionString %>"

 

 

 

SelectCommand="SELECT [StatusID],[Description] FROM [dbo].[tblStatus]">

 

</

 

asp:SqlDataSource>

 

3 Answers, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 12 Nov 2010, 12:44 PM
Hi,

Since the RadGrid control functions normally in an aspx page, the problem should be lying in the user control loading. Could you please elaborate on how and where do you load the user control? Is it a scenario with AJAX included?

Also, what do exactly you mean when saying that the edit forms do not work - they do not load, do not postback or the values from them are not saved?

Regards,
Tsvetina
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
pgodard
Top achievements
Rank 1
answered on 12 Nov 2010, 01:10 PM
Here is the code that loads the user control:

 

If Not Page.IsPostBack Then

 

 

Dim wucMainToolbar1 As Control = Me.FindControl("wucMainToolbar1")

 

 

If Not wucMainToolbar1 Is Nothing Then

 

 

Dim RadMainToolbar As RadToolBar = DirectCast(wucMainToolbar1.FindControl("RadMainToolbar"), RadToolBar)

 

RadMainToolbar.Items(0).Visible =

False

 

 

End If

 

ParentEmployeeIDTextBox.Text = Session(

"EmployeeID")

 

ParentSSNTextBox.Text = Session(

"SSN")

 

ParentHrsoCompanyIDTextBox.Text = Session(

"HRSOCompanyID")

 

ParentCompanyIDTextBox.Text = Session(

"CompanyID")

 

ParentJobIDTextBox.Text = Request.QueryString(

"JobID")

 

AddTab(

"Your Information")

 

AddPageView(RadTabStrip2.FindTabByText(

"Your Information"))

 

AddTab(

"Residential History")

 

AddTab(

"Employment History")

 

AddTab(

"Education History")

 

AddTab(

"Military")

 

AddTab(

"Skills")

 

AddTab(

"References")

 

AddTab(

"Resume")

 

AddTab(

"Licenses")

 

AddTab(

"Availability")

 

 

' AddTab("Free Form")

 

AddTab(

"Disclosure Questions")

 

AddTab(

"Background Check")

 

 

End If

 

 

End Sub

 

 

Private Sub AddTab(ByVal tabName As String)

 

 

Dim tab As RadTab = New RadTab

 

tab.Text = tabName

RadTabStrip2.Tabs.Add(tab)

 

End Sub

 

 

Protected Sub RadMultiPage1_PageViewCreated(ByVal sender As Object, ByVal e As RadMultiPageEventArgs) Handles RadMultiPage2.PageViewCreated

 

 

Dim userControlName As String = e.PageView.ID & ".ascx"

 

 

Dim userControl As Control = Page.LoadControl(userControlName)

 

userControl.ID = e.PageView.ID &

"_userControl"

 

e.PageView.Controls.Add(userControl)

 

End Sub

 

 

Private Sub AddPageView(ByVal tab As RadTab)

 

 

Dim pageView As RadPageView = New RadPageView

 

pageView.ID = tab.Text

RadMultiPage2.PageViews.Add(pageView)

pageView.CssClass =

"pageView"

 

tab.PageViewID = pageView.ID

 

End Sub

 

 

Protected Sub RadTabStrip2_TabClick(ByVal sender As Object, ByVal e As RadTabStripEventArgs) Handles RadTabStrip2.TabClick

 

AddPageView(e.Tab)

e.Tab.PageView.Selected =

True

 

 

End Sub


When in edit mode  none of the editors works. I ran the same code not from a user control it worked.  By not working I mean The controls show on the edit page but you cannot open the list of the combobox. the

 

GridDateTimeColumn , calendar or time show as well but cannot select a date from the caleendar even when data entered it does not register the information and this is only when the above code is used to load the usercontrol that contains the RadGrid.
.

 

 

,

0
Tsvetina
Telerik team
answered on 17 Nov 2010, 04:29 PM
Hello,

Since the way you load the user control seems correct, could you please also tell if you are using AJAX on the page and if turning it off (EnableAJAX=false in the RadAjaxManager/RadAjaxPanel) fixes the described issue?

Greetings,
Tsvetina
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
pgodard
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
pgodard
Top achievements
Rank 1
Share this question
or