我总是在gridset的文本框中得到一个空值。我的点击事件是我的代码:
foreach (GridRecord row in wdgTroubleshootCreateEdit.Rows)
{
int workflowCATParameterId = Convert.ToInt32(row.Items[0].Value);
TextBox workflowCATParameterValue =
(TextBox)row.Items[value].FindControl("txtWorkflowCATParameterValue");
workflowCATParameterValue.text
始终为空
答案 0 :(得分:2)
我正在使用11.2的最新服务版本。我试过了:
protected void Button2_Click(object sender, EventArgs e)
{
TextBox text = WebDataGrid1.Rows[0].Items[0].FindControl("TextBox1") as TextBox;
var rrr = text.Text;
}
并且工作正常:)我的网格被称为WebDataGrid1,第一列是模板化的,包含名为Text的TextBox:
<ig:WebDataGrid ID="WebDataGrid1" runat="server" Height="350px" Width="400px">
<Columns>
<ig:TemplateDataField Key="TemplateField_0">
<header text="TemplateField_0" />
<ItemTemplate>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</ItemTemplate>
</ig:TemplateDataField>
</Columns>
<Behaviors>
<ig:EditingCore>
<behaviors>
<ig:CellEditing>
</ig:CellEditing>
</behaviors>
</ig:EditingCore>
<ig:Activation>
</ig:Activation>
</Behaviors>
<Templates>
<ig:ItemTemplate ID="WebDataGrid1Template1" runat="server"
TemplateID="Template1">
</ig:ItemTemplate>
</Templates>
</ig:WebDataGrid>
我用IE 9测试了它:)
答案 1 :(得分:0)
通过javascript你可以这样做:
function OnExitedEditMode(sender,e){
var row = e.getCell().get_row();
var text = row.get_cellByColumnKey("YourDataKey").get_value();
....
}
在你的WebDataGrid中你需要把它放在:
<Behaviors>
<ig:EditingCore>
<Behaviors>
<ig:CellEditing EditModeActions-MouseClick="Single">
<ColumnSettings>
...
</ColumnSettings>
<CellEditingClientEvents ExitedEditMode="OnExitedEditMode" />
</ig:CellEditing>
</Behaviors>
</ig:EditingCore>
</Behaviors>