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

Multiple edit item template

5 Answers 343 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Deepak
Top achievements
Rank 1
Deepak asked on 23 Mar 2012, 06:24 AM
HI,
In the grid with inline editing the template is already defined with labels and text-boxes..But when the users clicks on the edit button on command item template i want the show the template with drop-downs i.e different template from current one.How can i do this?
Attached file is the screenschot taken in inline edit mode.
 i want to have dropdowns instead of text-boxes  , labels are same .on click of command in command item template.

5 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 23 Mar 2012, 06:47 AM
Hello Deepak,

method 1:

Grid / Form Template Edit Form

method 2:

<telerik:GridTemplateColumn>
                       <ItemTemplate>
                           <%# Eval("ID") %>
                       </ItemTemplate>
                       <EditItemTemplate>
                           <telerik:RadComboBox ID="RadComboBox1" runat="server">
                           </telerik:RadComboBox>
                       </EditItemTemplate>
                   </telerik:GridTemplateColumn>
  protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {
 
 if(e.Item is GridEditableItem && e.Item.IsInEditMode)
        {
              GridEditableItem item = (GridEditableItem)e.Item;
              RadComboBox RadComboBox1 = item.FindControl("RadComboBox1") as RadComboBox;
// access your combo here
              RadComboBox1.DataSource = "";
              RadComboBox1.DataBind();
        }
 
}




Thanks,
Jayesh Goyani
0
Shinu
Top achievements
Rank 2
answered on 23 Mar 2012, 08:49 AM
Hi Deepak,

Your screenshot appears as if you are using FormTemplate to edit the form. The following code snippet shows how to add DropDownList and show its SelectedValue as corresponding row value.

aspx:
<CommandItemTemplate>
   <asp:Button ID="Button1" runat="server"  Text="Edit" onclick="Edit_Click" />
</CommandItemTemplate>
<EditFormSettings EditFormType="AutoGenerated">
    <EditColumn UniqueName="EditCommandColumn1" FilterControlAltText="Filter EditCommandColumn1 column"></EditColumn>
    <FormTemplate>
        <table>
            <tr>
                <td>
                    <asp:Label ID="Label1" runat="server" Text="ShipName"></asp:Label>
                </td>  
                <td>
                    <asp:DropDownList ID="DropDownList1"  runat="server"></asp:DropDownList>
                </td
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label2" runat="server" Text="ShipCity"></asp:Label>
                </td>
                <td>
                    <asp:DropDownList ID="DropDownList2"  runat="server"></asp:DropDownList>
                </td>
            </tr>
        </table>
</FormTemplate>
</EditFormSettings>
 
<Columns>                   
   <telerik:GridBoundColumn DataField="ShipName" HeaderText="Shipping Name" UniqueName="ShipName" />
   <telerik:GridBoundColumn DataField="ShipCity" HeaderText="Shipping ShipCity" UniqueName="ShipCity" />
</Columns>

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
    {
        GridEditFormItem item = (GridEditFormItem)e.Item;
        GridDataItem ditem = (GridDataItem)item.ParentItem;
        TableCell shipname = (TableCell)ditem["ShipName"];
        TableCell shipcity = (TableCell)ditem["ShipCity"];
 
        DropDownList dropdownlist1 = (DropDownList)item.FindControl("DropDownList1");
        dropdownlist1.DataSourceID = "SqlDataSource1";
        dropdownlist1.DataTextField = "ShipName";
        dropdownlist1.DataValueField = "ShipName";
        dropdownlist1.SelectedValue = shipname.Text;
        dropdownlist1.DataBind();
 
        DropDownList dropdownlist2 = (DropDownList)item.FindControl("DropDownList2");
        dropdownlist2.DataSourceID = "SqlDataSource1";
        dropdownlist2.DataTextField = "ShipCity";
        dropdownlist2.DataValueField = "ShipCity";
        dropdownlist2.SelectedValue = shipcity.Text;
        dropdownlist2.DataBind();
    }
}
 
protected void Edit_Click(object sender, EventArgs e)
{
    foreach (GridDataItem item in RadGrid1.SelectedItems)
    {
        item.Edit = true;
        RadGrid1.Rebind();
    }
 
}

Please paste your code if you need further assistance.

Hope this helps.
Thanks,
-Shinu.

0
Deepak
Top achievements
Rank 1
answered on 23 Mar 2012, 09:30 AM

<

 

 

telerik:RadGrid AutoGenerateColumns="False" ID="RadGridAssignment" AllowFilteringByColumn="False"

 

 

 

AllowSorting="True" PageSize="6" ShowFooter="False" AllowPaging="True" runat="server"

 

 

 

EnableLinqExpressions="False" EnableHeaderContextMenu="False" EnableHeaderContextFilterMenu="False"

 

 

 

OnDeleteCommand="RadGridAssignment_DeleteCommand" OnNeedDataSource="RadGridAssignment_NeedDataSource"

 

 

 

OnItemDataBound="RadGridAssignment_ItemDataBound" OnItemCreated="RadGridAssignment_ItemCreated"

 

 

 

OnCancelCommand="RadGridAssignment_CancelCommand" OnInsertCommand="RadGridAssignment_InsertCommand"

 

 

 

OnItemCommand="RadGridAssignment_ItemCommand" OnUpdateCommand="RadGridAssignment_UpdateCommand"

 

 

 

OnPreRender="RadGridAssignment_PreRender" EnableEmbeddedSkins="True" EnableTheming="True"

 

 

 

Skin="Office2007" GridLines="None" HeaderStyle-HorizontalAlign="Left" HorizontalAlign="Center"

 

 

 

ShowGroupPanel="True">

 

 

 

<MasterTableView AllowFilteringByColumn="False" AllowSorting="True" AllowMultiColumnSorting="True"

 

 

 

AllowPaging="True" TableLayout="Auto" CommandItemDisplay="Top" InsertItemDisplay="Top"

 

 

 

Dir="LTR" EditMode="EditForms" DataKeyNames="ObjectId,ParentObjectId" GridLines="None"

 

 

 

EnableTheming="True">

 

 

 

<HeaderStyle Font-Bold="true" />

 

 

 

<CommandItemSettings ShowAddNewRecordButton="true" ShowRefreshButton="false" AddNewRecordText=""

 

 

 

AddNewRecordImageUrl="~/client/Images/Edit.gif" />

 

 

 

<Columns>

 

 

 

<telerik:GridBoundColumn DataField="ParentObjectTypeId" UniqueName="ParentObjectTypeId"

 

 

 

Display="false">

 

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn DataField="ParentObjectId" UniqueName="ParentObjectId"

 

 

 

Display="false">

 

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn DataField="ObjectId" UniqueName="ObjectId"

 

 

 

Display="false">

 

 

 

</telerik:GridBoundColumn>

 

 

 

 

<telerik:GridEditCommandColumn UniqueName="EditColumn" ButtonType="ImageButton" EditImageUrl="~/client/Images/Edit.gif"

 

 

 

EditText="Edit">

 

 

 

</telerik:GridEditCommandColumn>

 

 

 

<telerik:GridButtonColumn CommandName="Delete" ImageUrl="~/client/Images/Delete.gif"

 

 

 

ButtonType="ImageButton" CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType"

 

 

 

Text="Delete" UniqueName="Delete">

 

 

 

</telerik:GridButtonColumn>

 

 

 

<telerik:GridBoundColumn DataField="ObjectName" HeaderText="ObjectName" SortExpression="ObjectName"

 

 

 

UniqueName="ObjectName">

 

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn DataField="AssessorName" HeaderText="Assessor" SortExpression="AssessorName"

 

 

 

UniqueName="AssessorName">

 

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn DataField="Reviewer1" HeaderText="ReviewerLevel1" SortExpression="ReviewerLevel1"

 

 

 

UniqueName="Reviewer1">

 

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn DataField="Reviewer2" HeaderText="ReviewerLevel2" SortExpression="ReviewerLevel2"

 

 

 

UniqueName="Reviewer2">

 

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn DataField="Reviewer3" HeaderText="ReviewerLevel3" SortExpression="ReviewerLevel3"

 

 

 

UniqueName="Reviewer3">

 

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn DataField="Reviewer4" HeaderText="ReviewerLevel4" SortExpression="ReviewerLevel4"

 

 

 

UniqueName="Reviewer4">

 

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn DataField="Reviewer5" HeaderText="ReviewerLevel5" SortExpression="ReviewerLevel5"

 

 

 

UniqueName="Reviewer5">

 

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridTemplateColumn UniqueName="ParentObjectName" DataField="ParentObjectName"

 

 

 

GroupByExpression="ParentObjectName Group By ParentObjectName " Visible="false">

 

 

 

</telerik:GridTemplateColumn>

 

 

 

</Columns>

 

 

 

<GroupByExpressions>

 

 

 

<telerik:GridGroupByExpression>

 

 

 

<GroupByFields>

 

 

 

<telerik:GridGroupByField FieldName="ParentObjectName" />

 

 

 

</GroupByFields>

 

 

 

<SelectFields>

 

 

 

<telerik:GridGroupByField FieldName="ParentObjectName" FieldAlias="Organization"

 

 

 

HeaderText="Organization" />

 

 

 

</SelectFields>

 

 

 

</telerik:GridGroupByExpression>

 

 

 

</GroupByExpressions>

 

 

 

<EditFormSettings EditFormType="Template">

 

 

 

<FormTemplate>

 

 

 

<table>

 

 

 

<tr>

 

 

 

<td class="cell_padding" colspan="3">

 

 

 

</td>

 

 

 

</tr>

 

 

 

<tr>

 

 

 

<td class="label" style="width: 50px;">

 

 

 

<asp:Label ID="lblAssessor" runat="server" Height="15" Width="80"></asp:Label>

 

 

 

</td>

 

 

 

<td style="padding-top: 1px; width: 500px; padding-left: 4px;">

 

 

 

<PortalControls:PortalTextBox ID="tb_User" runat="server" Type="User" PopulateEmail="false"

 

 

 

Visible="true" DisplayMode="Add " LabelText="Assessor" Height="15" Width="250" />

 

 

 

</td>

 

 

 

</tr>

 

 

 

<tr>

 

 

 

<td class="label">

 

 

 

<asp:Label ID="Label1" runat="server"></asp:Label>

 

 

 

</td>

 

 

 

<td style="padding-top: 1px; width: 1600px; padding-left: 4px;">

 

 

 

<PortalControls:PortalTextBox ID="PortalTextBox1" runat="server" Type="User" PopulateEmail="false"

 

 

 

Visible="true" DisplayMode="Add " LabelText="Reviewer1" Height="15" Width="250" />

 

 

 

</td>

 

 

 

<td class="label">

 

 

 

<asp:Label ID="Label2" runat="server"></asp:Label>

 

 

 

</td>

 

 

 

<td style="padding-top: 1px; width: 250px; padding-left: 4px;">

 

 

 

<PortalControls:PortalTextBox ID="PortalTextBox2" runat="server" Type="User" PopulateEmail="false"

 

 

 

Visible="true" DisplayMode="Add " LabelText="Reviewer2" Height="15" Width="250" />

 

 

 

</td>

 

 

 

</tr>

 

 

 

</tr>

 

 

 

<tr>

 

 

 

<td class="label">

 

 

 

<asp:Label ID="Label3" runat="server"></asp:Label>

 

 

 

</td>

 

 

 

<td style="padding-top: 1px; width: 500px; padding-left: 4px;">

 

 

 

<PortalControls:PortalTextBox ID="PortalTextBox3" runat="server" Type="User" PopulateEmail="false"

 

 

 

Visible="true" DisplayMode="Add " LabelText="Reviewer3" Height="15" Width="250" />

 

 

 

</td>

 

 

 

<td class="label">

 

 

 

<asp:Label ID="Label4" runat="server"></asp:Label>

 

 

 

</td>

 

 

 

<td style="padding-top: 1px; width: 500px; padding-left: 4px;">

 

 

 

<PortalControls:PortalTextBox ID="PortalTextBox4" runat="server" Type="User" PopulateEmail="false"

 

 

 

Visible="true" DisplayMode="Add " LabelText="Reviewer4" Height="15" Width="250" />

 

 

 

</td>

 

 

 

</tr>

 

 

 

<tr>

 

 

 

<td class="label">

 

 

 

<asp:Label ID="Label5" runat="server"></asp:Label>

 

 

 

</td>

 

 

 

<td style="padding-top: 1px; width: 250px; padding-left: 4px;">

 

 

 

<PortalControls:PortalTextBox ID="PortalTextBox5" runat="server" Type="User" PopulateEmail="false"

 

 

 

Visible="true" DisplayMode="Add " LabelText="Reviewer5" Height="15" Width="250" />

 

 

 

</td>

 

 

 

</tr>

 

 

 

<tr>

 

 

 

<td colspan="2" style="padding-top: 4px; padding-bottom: 4px; vertical-align: middle;">

 

 

 

<asp:Button ID="btnUpdate" runat="server" Text="Save" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>

 

 

 

</asp:Button>

 

 

 

<asp:Button ID="btnCancel" runat="server" Text="Cancel" CausesValidation="False"

 

 

 

CommandName="Cancel"></asp:Button>

 

 

 

</td>

 

 

 

</tr>

 

 

 

<tr>

 

 

 

<td colspan="3" class="cell_padding">

 

 

 

</td>

 

 

 

</tr>

 

 

 

</table>

 

 

 

</FormTemplate>

 

 

 

</EditFormSettings>

 

 

 

</MasterTableView>

 

 

 

<ClientSettings AllowColumnsReorder="true" ReorderColumnsOnClient="true" AllowDragToGroup="true">

 

 

 

<Resizing AllowRowResize="True" EnableRealTimeResize="True" ResizeGridOnColumnResize="True"

 

 

 

AllowColumnResize="True"></Resizing>

 

 

 

<Selecting AllowRowSelect="True"></Selecting>

 

 

 

</ClientSettings>

 

 

 

<GroupingSettings ShowUnGroupButton="true" />

 

</

 

 

telerik:RadGrid>

 




this is the code .The inline edit works fine.I havent added drop downs as yet.I think we will have to switch between the visibility of the text boxes and drop downs as true or false.
when inline edit visibility of textbox = true and dropdowns  = false
when command item edit click , visibility of drop-downs = true and visibility of text-box = false.
Is there any other way to implement it ? 
0
Deepak
Top achievements
Rank 1
answered on 23 Mar 2012, 09:30 AM

<

 

 

telerik:RadGrid AutoGenerateColumns="False" ID="RadGridAssignment" AllowFilteringByColumn="False"

 

 

 

AllowSorting="True" PageSize="6" ShowFooter="False" AllowPaging="True" runat="server"

 

 

 

EnableLinqExpressions="False" EnableHeaderContextMenu="False" EnableHeaderContextFilterMenu="False"

 

 

 

OnDeleteCommand="RadGridAssignment_DeleteCommand" OnNeedDataSource="RadGridAssignment_NeedDataSource"

 

 

 

OnItemDataBound="RadGridAssignment_ItemDataBound" OnItemCreated="RadGridAssignment_ItemCreated"

 

 

 

OnCancelCommand="RadGridAssignment_CancelCommand" OnInsertCommand="RadGridAssignment_InsertCommand"

 

 

 

OnItemCommand="RadGridAssignment_ItemCommand" OnUpdateCommand="RadGridAssignment_UpdateCommand"

 

 

 

OnPreRender="RadGridAssignment_PreRender" EnableEmbeddedSkins="True" EnableTheming="True"

 

 

 

Skin="Office2007" GridLines="None" HeaderStyle-HorizontalAlign="Left" HorizontalAlign="Center"

 

 

 

ShowGroupPanel="True">

 

 

 

<MasterTableView AllowFilteringByColumn="False" AllowSorting="True" AllowMultiColumnSorting="True"

 

 

 

AllowPaging="True" TableLayout="Auto" CommandItemDisplay="Top" InsertItemDisplay="Top"

 

 

 

Dir="LTR" EditMode="EditForms" DataKeyNames="ObjectId,ParentObjectId" GridLines="None"

 

 

 

EnableTheming="True">

 

 

 

<HeaderStyle Font-Bold="true" />

 

 

 

<CommandItemSettings ShowAddNewRecordButton="true" ShowRefreshButton="false" AddNewRecordText=""

 

 

 

AddNewRecordImageUrl="~/client/Images/Edit.gif" />

 

 

 

<Columns>

 

 

 

<telerik:GridBoundColumn DataField="ParentObjectTypeId" UniqueName="ParentObjectTypeId"

 

 

 

Display="false">

 

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn DataField="ParentObjectId" UniqueName="ParentObjectId"

 

 

 

Display="false">

 

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn DataField="ObjectId" UniqueName="ObjectId"

 

 

 

Display="false">

 

 

 

</telerik:GridBoundColumn>

 

 

 

 

<telerik:GridEditCommandColumn UniqueName="EditColumn" ButtonType="ImageButton" EditImageUrl="~/client/Images/Edit.gif"

 

 

 

EditText="Edit">

 

 

 

</telerik:GridEditCommandColumn>

 

 

 

<telerik:GridButtonColumn CommandName="Delete" ImageUrl="~/client/Images/Delete.gif"

 

 

 

ButtonType="ImageButton" CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType"

 

 

 

Text="Delete" UniqueName="Delete">

 

 

 

</telerik:GridButtonColumn>

 

 

 

<telerik:GridBoundColumn DataField="ObjectName" HeaderText="ObjectName" SortExpression="ObjectName"

 

 

 

UniqueName="ObjectName">

 

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn DataField="AssessorName" HeaderText="Assessor" SortExpression="AssessorName"

 

 

 

UniqueName="AssessorName">

 

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn DataField="Reviewer1" HeaderText="ReviewerLevel1" SortExpression="ReviewerLevel1"

 

 

 

UniqueName="Reviewer1">

 

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn DataField="Reviewer2" HeaderText="ReviewerLevel2" SortExpression="ReviewerLevel2"

 

 

 

UniqueName="Reviewer2">

 

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn DataField="Reviewer3" HeaderText="ReviewerLevel3" SortExpression="ReviewerLevel3"

 

 

 

UniqueName="Reviewer3">

 

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn DataField="Reviewer4" HeaderText="ReviewerLevel4" SortExpression="ReviewerLevel4"

 

 

 

UniqueName="Reviewer4">

 

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn DataField="Reviewer5" HeaderText="ReviewerLevel5" SortExpression="ReviewerLevel5"

 

 

 

UniqueName="Reviewer5">

 

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridTemplateColumn UniqueName="ParentObjectName" DataField="ParentObjectName"

 

 

 

GroupByExpression="ParentObjectName Group By ParentObjectName " Visible="false">

 

 

 

</telerik:GridTemplateColumn>

 

 

 

</Columns>

 

 

 

<GroupByExpressions>

 

 

 

<telerik:GridGroupByExpression>

 

 

 

<GroupByFields>

 

 

 

<telerik:GridGroupByField FieldName="ParentObjectName" />

 

 

 

</GroupByFields>

 

 

 

<SelectFields>

 

 

 

<telerik:GridGroupByField FieldName="ParentObjectName" FieldAlias="Organization"

 

 

 

HeaderText="Organization" />

 

 

 

</SelectFields>

 

 

 

</telerik:GridGroupByExpression>

 

 

 

</GroupByExpressions>

 

 

 

<EditFormSettings EditFormType="Template">

 

 

 

<FormTemplate>

 

 

 

<table>

 

 

 

<tr>

 

 

 

<td class="cell_padding" colspan="3">

 

 

 

</td>

 

 

 

</tr>

 

 

 

<tr>

 

 

 

<td class="label" style="width: 50px;">

 

 

 

<asp:Label ID="lblAssessor" runat="server" Height="15" Width="80"></asp:Label>

 

 

 

</td>

 

 

 

<td style="padding-top: 1px; width: 500px; padding-left: 4px;">

 

 

 

<PortalControls:PortalTextBox ID="tb_User" runat="server" Type="User" PopulateEmail="false"

 

 

 

Visible="true" DisplayMode="Add " LabelText="Assessor" Height="15" Width="250" />

 

 

 

</td>

 

 

 

</tr>

 

 

 

<tr>

 

 

 

<td class="label">

 

 

 

<asp:Label ID="Label1" runat="server"></asp:Label>

 

 

 

</td>

 

 

 

<td style="padding-top: 1px; width: 1600px; padding-left: 4px;">

 

 

 

<PortalControls:PortalTextBox ID="PortalTextBox1" runat="server" Type="User" PopulateEmail="false"

 

 

 

Visible="true" DisplayMode="Add " LabelText="Reviewer1" Height="15" Width="250" />

 

 

 

</td>

 

 

 

<td class="label">

 

 

 

<asp:Label ID="Label2" runat="server"></asp:Label>

 

 

 

</td>

 

 

 

<td style="padding-top: 1px; width: 250px; padding-left: 4px;">

 

 

 

<PortalControls:PortalTextBox ID="PortalTextBox2" runat="server" Type="User" PopulateEmail="false"

 

 

 

Visible="true" DisplayMode="Add " LabelText="Reviewer2" Height="15" Width="250" />

 

 

 

</td>

 

 

 

</tr>

 

 

 

</tr>

 

 

 

<tr>

 

 

 

<td class="label">

 

 

 

<asp:Label ID="Label3" runat="server"></asp:Label>

 

 

 

</td>

 

 

 

<td style="padding-top: 1px; width: 500px; padding-left: 4px;">

 

 

 

<PortalControls:PortalTextBox ID="PortalTextBox3" runat="server" Type="User" PopulateEmail="false"

 

 

 

Visible="true" DisplayMode="Add " LabelText="Reviewer3" Height="15" Width="250" />

 

 

 

</td>

 

 

 

<td class="label">

 

 

 

<asp:Label ID="Label4" runat="server"></asp:Label>

 

 

 

</td>

 

 

 

<td style="padding-top: 1px; width: 500px; padding-left: 4px;">

 

 

 

<PortalControls:PortalTextBox ID="PortalTextBox4" runat="server" Type="User" PopulateEmail="false"

 

 

 

Visible="true" DisplayMode="Add " LabelText="Reviewer4" Height="15" Width="250" />

 

 

 

</td>

 

 

 

</tr>

 

 

 

<tr>

 

 

 

<td class="label">

 

 

 

<asp:Label ID="Label5" runat="server"></asp:Label>

 

 

 

</td>

 

 

 

<td style="padding-top: 1px; width: 250px; padding-left: 4px;">

 

 

 

<PortalControls:PortalTextBox ID="PortalTextBox5" runat="server" Type="User" PopulateEmail="false"

 

 

 

Visible="true" DisplayMode="Add " LabelText="Reviewer5" Height="15" Width="250" />

 

 

 

</td>

 

 

 

</tr>

 

 

 

<tr>

 

 

 

<td colspan="2" style="padding-top: 4px; padding-bottom: 4px; vertical-align: middle;">

 

 

 

<asp:Button ID="btnUpdate" runat="server" Text="Save" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>

 

 

 

</asp:Button>

 

 

 

<asp:Button ID="btnCancel" runat="server" Text="Cancel" CausesValidation="False"

 

 

 

CommandName="Cancel"></asp:Button>

 

 

 

</td>

 

 

 

</tr>

 

 

 

<tr>

 

 

 

<td colspan="3" class="cell_padding">

 

 

 

</td>

 

 

 

</tr>

 

 

 

</table>

 

 

 

</FormTemplate>

 

 

 

</EditFormSettings>

 

 

 

</MasterTableView>

 

 

 

<ClientSettings AllowColumnsReorder="true" ReorderColumnsOnClient="true" AllowDragToGroup="true">

 

 

 

<Resizing AllowRowResize="True" EnableRealTimeResize="True" ResizeGridOnColumnResize="True"

 

 

 

AllowColumnResize="True"></Resizing>

 

 

 

<Selecting AllowRowSelect="True"></Selecting>

 

 

 

</ClientSettings>

 

 

 

<GroupingSettings ShowUnGroupButton="true" />

 

</

 

 

telerik:RadGrid>

 




this is the code .The inline edit works fine.I havent added drop downs as yet.I think we will have to switch between the visibility of the text boxes and drop downs as true or false.
when inline edit visibility of textbox = true and dropdowns  = false
when command item edit click , visibility of drop-downs = true and visibility of text-box = false.
Is there any other way to implement it ? 
0
Shinu
Top achievements
Rank 2
answered on 24 Mar 2012, 07:17 AM
Hi Deepak,

Thanks for pasting your code.If you want to change the visibility of TextBox and DropDownList based on whether the RadGrid is in edit mode or insert mode, you can set it from aspx itself based on the condition.
 Here is a sample code.

ASPX:
<tr>
  <td class="label">
   <asp:Label ID="Label5" runat="server"></asp:Label>
  </td>
  <td style="padding-top: 1px; width: 250px; padding-left: 4px;">
    <asp:TextBox ID="PortalTextBox5" runat="server" type="User" populateemail="false"
    Visible='<%#(Container is GridEditFormInsertItem)? true : false %>' displaymode="Add "
    labeltext="Reviewer5" Height="15" Width="250" />
    <asp:DropDownList ID="DropDownList1" Width="250" runat="server"
    Visible='<%#(Container is GridEditFormInsertItem)? false : true %>' >
    </asp:DropDownList>
  </td>
</tr>

Regards,
-Shinu.
Tags
Grid
Asked by
Deepak
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Shinu
Top achievements
Rank 2
Deepak
Top achievements
Rank 1
Share this question
or