Hi, I am new to this forum and new to rad controls. I have spent a little time on understanding the usage of these control and no trying to implement one.
I have a radgrid binded to a datatable(code behind). I would like to display dropdown for a column(say Prefix) with prefilled values from another datatable when in Edit Mode. I tried using GridDropDownColumn this does not display data for that column but does gives me a dropdown control in Edit mode.
I have the grid this way.
-----------------------------Control---------------------------------------------
</telerik:RadGrid>
-----------------------------CodeBehind---------------------------------------------
Page Load :-
I have a radgrid binded to a datatable(code behind). I would like to display dropdown for a column(say Prefix) with prefilled values from another datatable when in Edit Mode. I tried using GridDropDownColumn this does not display data for that column but does gives me a dropdown control in Edit mode.
I have the grid this way.
-----------------------------Control---------------------------------------------
<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="true" OnNeedDataSource="RadGrid1_NeedDataSource" AllowSorting="true" GridLines="None" PageSize="5" Skin="Web20" Width="80%" onpageindexchanged="RadGrid1_PageIndexChanged" onpagesizechanged="RadGrid1_PageSizeChanged" OnUpdateCommand="RadGrid1_UpdateCommand" onitemdatabound="RadGrid1_ItemDataBound"> <ClientSettings AllowKeyboardNavigation="true" EnablePostBackOnRowClick="true"> <Selecting AllowRowSelect="true" /> <Resizing AllowColumnResize="True" AllowRowResize="false" ResizeGridOnColumnResize="false" ClipCellContentOnResize="true" EnableRealTimeResize="false" AllowResizeToFit="true" /> </ClientSettings> <MasterTableView Width="100%" AutoGenerateColumns="false" > <Columns> <telerik:GridButtonColumn CommandName="Edit" Text="Edit" UniqueName="Edit"> </telerik:GridButtonColumn> <telerik:GridButtonColumn CommandName="Replace" Text="Replace" UniqueName="Replace"> </telerik:GridButtonColumn> <telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="Delete"> </telerik:GridButtonColumn> <telerik:GridBoundColumn DataField="P" HeaderText="Prefix"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="FN" HeaderText="FirstName"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="MN" HeaderText="MiddleI"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="LN" HeaderText="LastName"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="SchoolName" HeaderText="LocatedAt"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="PersonID" HeaderText="PersonID" Visible="false" UniqueName="PersonID"> </telerik:GridBoundColumn> </Columns> </MasterTableView> <PagerStyle Mode="NextPrevAndNumeric" /></telerik:RadGrid>
-----------------------------CodeBehind---------------------------------------------
Page Load :-
RadGrid1.DataSource = dsAdminInfo.Tables[0];<br>RadGrid1.DataBind(); protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e) { RadGrid1.DataSource = ((DataSet)Session["AdminInfo"]).Tables[0]; }
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) { if ((e.Item is GridEditFormItem) && (e.Item.IsInEditMode)) { GridEditFormItem editform = (GridEditFormItem)e.Item; editform["PersonID"].Parent.Visible = false; }