I am using RadGrid with my own control as edit control in DNN. I need ModuleConfiguration information in the edit control so that i can load correct data in the listboxes and comboboxes. These values vary by ModuleId. How can I pass ModuleConfiguration or ModuleId to edit control that i created for RadGrid. In the regular case I load the control and then i set the ModuleConfiguration, since the control extends PortalModuleBase. Can you please provide how i can achieve this? I need the solution quickly. I appreciate any help.
Thank you,
Ana
5 Answers, 1 is accepted
Can you elaborate a bit on your scenario? Where in RadGrid you are adding the mentioned edit control?
Greetings,
Iana
the Telerik team
Thank you for getting back to me! I appreciate it very much.
I am using telerik asp.net ajax grid with DotNetNuke. I am using the grid in the DNN module like this, with user defined edit control (EditTest.ascx).
<telerik:RadGrid ID="_testGrid" runat="server" AllowPaging="true" AllowSorting="True"
AutoGenerateColumns="False" GridLines="None" OnNeedDataSource="_testGrid_NeedDataSource" OnInsertCommand="_testGrid_InsertCommand"
ShowStatusBar="true" OnItemDataBound="_testGrid_ItemDataBound" OnUpdateCommand="_testGrid_UpdateCommand"
OnSortCommand="_testGrid_SortCommand" ShowFooter="true">
<MasterTableView Name="_testMasterTable" CommandItemDisplay="Top" AllowCustomPaging="true"
DataKeyNames="TestId" Width="100%" EditMode="PopUp">
<PagerStyle Mode="NextPrevAndNumeric" AlwaysVisible="true" />
<Columns>
<telerik:GridEditCommandColumn FilterControlAltText="Filter EditCommandColumn column"
UniqueName="TestEditCommand">
</telerik:GridEditCommandColumn>
.
.
.
<EditFormSettings UserControlName="~/EditTest.ascx"
EditFormType="WebUserControl" CaptionFormatString="Edit Test: {0}" CaptionDataField="TestNum"
PopUpSettings-Width="500px" PopUpSettings-Modal="true">
</EditColumn>
</EditFormSettings>
</MasterTableView>
.
.
.
I need to pass the DNN's ModuleInfo object to EditTest.ascx when user clicks on edit or add new item to the grid. How do i pass it? In the case where I am not using telerik radgrid, i load the control and then set the ModuleConfiguration (object of ModuleInfo) on the control so that i will have accessto it in the EditTest control. But when I am using RadGrid, i don't load the control, so i don't know how to pass this object to it. Is there a way i can get access to the edit control before it is going to load the data to display it to user? Is there a event that is fired before the control is displayed to the user that i can use it to set the ModuleConfiguration? Any idea is greately appreciated.
Thank you,
Ana
You can get the edit form and its controls on ItemCreated or ItemDataBound. The later is to be used when you need to change the values of the form edit controls. More information on how to access the controls is available here (Setting properties without using binding expressions section).
Furthermore, you can handle the ItemCommand event of the grid and to set predefined values for the edit form as shown at the bottom of this topic:
http://www.telerik.com/help/aspnet-ajax/grid-inserting-values-usercontrol-formtemplate.html
Greetings,
Iana
the Telerik team