[英]Adding Dropdown inside Row Edit Template using Infragistics WebDataGrid
I have a WebDataGrid which includes a WebDropDown in the Row Edit template The webDropdown is linked to one of the columns as shown 我有一个WebDataGrid,在“行编辑”模板中包含一个WebDropDown。webDropdown链接到其中一列,如图所示
<Template>
<div style="background-color:white;border:1px solid black;">
COMP_ID:<asp:TextBox ID="control_COMP_ID" runat="server"></asp:TextBox>
<br/>
COMP_NAME_EN:<asp:TextBox ID="control_COMP_NAME_EN" runat="server"></asp:TextBox>
<br/>
COMP_TYPE:<ig:WebDropDown ID="cmbCompTypes" runat="server" Width="200px"
DataSource="<%#GetCompanyTypes()%>"
TextField="TYPE_NAME_EN"
ValueField ="TYPE_ID"
></ig:WebDropDown>
<br/>
<asp:Button ID="buttonOK" runat="server" OnClientClick="return" Text="OK" UseSubmitBehavior="False" />
<asp:Button ID="buttonCancel" runat="server" CausesValidation="False" OnClientClick="return" Text="Cancel" UseSubmitBehavior="False" />
</div>
</Template>
When Opening the row edit template, I need the dropdown selected value to be set based on the current column value. 打开行编辑模板时,我需要根据当前列值设置下拉选择的值。 I did not fine any post which discuss this topic. 我没有讨论此主题的任何帖子。 Thank you Imad Z 谢谢Imad Z
I have created a sample for you in order to show you how to use WebDataGrid RowEditingTemplate and WebDropDown bound to the column value. 我为您创建了一个示例 ,以向您展示如何使用绑定到列值的WebDataGrid RowEditingTemplate和WebDropDown 。
It is important to use the RowEditingClientBindings : 使用RowEditingClientBindings很重要 :
<ig:RowEditingClientBinding ColumnKey="Item0" ControlID="Item0" GetValueJavaScript="$find({ClientID}).get_currentValue()"
SetValueJavaScript="$find({ClientID}).set_currentValue({value}, true)" />
Code snippet: 程式码片段:
<ig:WebDataGrid ID="WebDataGrid1" runat="server" Height="350px" Width="649px" AutoGenerateColumns="true"
...
<ig:RowEditingTemplate CancelButton="buttonCancel" OKButton="buttonOK" EditModeActions-MouseClick="Double">
<ClientBindings>
<ig:RowEditingClientBinding ColumnKey="Item0" ControlID="Item0" GetValueJavaScript="$find({ClientID}).get_currentValue()"
SetValueJavaScript="$find({ClientID}).set_currentValue({value}, true)" />
</ClientBindings>
<RowEditingClientEvents TemplateClosed="WebDataGrid1_RowEditing_TemplateClosed" />
<Template>
<div style="background-color: white; border: 1px solid black;">
Value:
<ig:WebDropDown ID="Item0" runat="server"
Width="200px">
<Items>
<ig:DropDownItem Value="Item0" Text="Item0" />
<ig:DropDownItem Value="Item1" Text="Item1" />
<ig:DropDownItem Value="Item2" Text="Item2" />
</Items>
</ig:WebDropDown>
<br />
<asp:Button ID="buttonOK" runat="server" OnClientClick="return" Text="OK" UseSubmitBehavior="False" />
<asp:Button ID="buttonCancel" runat="server" CausesValidation="False" OnClientClick="return"
Text="Cancel" UseSubmitBehavior="False" />
</div>
</Template>
</ig:RowEditingTemplate>
...
Have a look at the sample . 看一下样本 。 I hope you will find it useful. 希望您会发现它有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.