Hi!
I want to access the controls such as dropdown and textbox defined in editformsettings of GridTableView in code behind to populate the values from database when the user clicks on add new record on the GridTable View.. right now i cant access those controls ... like we do in this code
if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
{
GridEditFormItem edititem = (GridEditFormItem)e.Item;
DropDown txt = (DropDownedititem.FindControl("Dro");//access the DropDown in FormTemplate
}
but i want to do when user clicks on add new record, so i extract value from RadGridDataKeyValue and select value from database and populate the controls inside GridTableView ...
note : i want to bind drop down in code behind not in html file..
I want to access the controls such as dropdown and textbox defined in editformsettings of GridTableView in code behind to populate the values from database when the user clicks on add new record on the GridTable View.. right now i cant access those controls ... like we do in this code
if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
{
GridEditFormItem edititem = (GridEditFormItem)e.Item;
DropDown txt = (DropDownedititem.FindControl("Dro");//access the DropDown in FormTemplate
}
but i want to do when user clicks on add new record, so i extract value from RadGridDataKeyValue and select value from database and populate the controls inside GridTableView ...
note : i want to bind drop down in code behind not in html file..
<telerik:RadGrid ID="RadGridRunDate" AutoGenerateColumns="false" OnNeedDataSource="RadGridRunDate_NeedDataSource" ShowGroupPanel="true" OnItemCreated="RadGridRunDate_ItemCreated" OnInsertCommand="RadGridRunDate_InsertCommand" OnDetailTableDataBind="RadGridRunData_DetailTableDataBind" OnItemCommand="RadGridRunDate_ItemCommand"AllowFilteringByColumn="true" EnableEmbeddedSkins="false" Skin="GridDefault"AllowPaging="true" AllowSorting="true" runat="server" ><MasterTableView DataKeyNames="RunDate" EnableHeaderContextMenu="true" EditMode="PopUp" > <DetailTables> <telerik:GridTableView DataKeyNames="RunID" Width="100%" runat="server" EditMode="PopUp" CommandItemDisplay="Top" Name="Runs"><Columns><telerik:GridBoundColumn SortExpression="RunCode" HeaderText="<%$ Resources:Lang, Run_ID%>"DataField="RunCode" UniqueName="RunCode"></telerik:GridBoundColumn><telerik:GridBoundColumn SortExpression="RunDate" HeaderText="<%$ Resources:Lang, Run_Date%>"DataField="RunDate" UniqueName="RunDate"></telerik:GridBoundColumn><telerik:GridBoundColumn SortExpression="RunType.RunTypeCode" HeaderText="<%$ Resources:Lang, Run_Type%>"DataField="RunType.RunTypeCode" UniqueName="RunType.RunTypeCode"></telerik:GridBoundColumn> <telerik:GridBoundColumn SortExpression="TimeWindow.StartTime" HeaderText="<%$ Resources:Lang, Start_Time%>"DataField="TimeWindow.StartTime" UniqueName="TimeWindow.StartTime"></telerik:GridBoundColumn><telerik:GridBoundColumn SortExpression="TimeWindow.EndTime" HeaderText="<%$ Resources:Lang, End_Time%>"DataField="TimeWindow.EndTime" UniqueName="TimeWindow.EndTime"></telerik:GridBoundColumn></Columns><EditFormSettings InsertCaption="Add New Run" CaptionFormatString="Edit RunID: {0}"CaptionDataField="RunID" EditFormType="Template"><FormTemplate><table><tr>RunCode<td></td><td><asp:TextBox runat="server" ID="TextBoxRunCode"></asp:TextBox></td></tr><tr><td>RunDate</td><td><telerik:RadDatePicker ID="RadDatePickerRunDate" runat="server"></telerik:RadDatePicker></td></tr><tr><td>Depot</td><td><asp:Label runat="server" ID="LabelDepotCode"></asp:Label></td></tr><tr><td>Run Type</td><td></td></tr><tr><td>Start Time</td><td><telerik:RadTimePicker ID="RadTimePickerStartTime" runat="server"></telerik:RadTimePicker></td></tr><tr><td>End Time</td><td><telerik:RadTimePicker ID="RadTimePickerEndTime" runat="server"></telerik:RadTimePicker></td></tr><tr><td></td><td><asp:Button runat="server" ID="buttonAddRun" Text="Text" /></td></tr></table></FormTemplate></EditFormSettings> </telerik:GridTableView> </DetailTables> <Columns><telerik:GridBoundColumn HeaderText="<%$ Resources:Lang, Run_Date%>" DataField="RunDate" ItemStyle-CssClass="itemStyle" FilterControlWidth="30px"></telerik:GridBoundColumn> </Columns> <CommandItemTemplate></CommandItemTemplate> </MasterTableView> <ClientSettings>
<Selecting AllowRowSelect="true" /> </ClientSettings> </telerik:RadGrid>