Reputation: 11
i always get a null value in a textbox from grid.here is my code on my click event:
foreach (GridRecord row in wdgTroubleshootCreateEdit.Rows)
{
int workflowCATParameterId = Convert.ToInt32(row.Items[0].Value);
TextBox workflowCATParameterValue =
(TextBox)row.Items[value].FindControl("txtWorkflowCATParameterValue");
workflowCATParameterValue.text
always null
Upvotes: 0
Views: 7049
Reputation: 3170
By javascript you can do this:
function OnExitedEditMode(sender,e){
var row = e.getCell().get_row();
var text = row.get_cellByColumnKey("YourDataKey").get_value();
....
}
And in your WebDataGrid you need to put this:
<Behaviors>
<ig:EditingCore>
<Behaviors>
<ig:CellEditing EditModeActions-MouseClick="Single">
<ColumnSettings>
...
</ColumnSettings>
<CellEditingClientEvents ExitedEditMode="OnExitedEditMode" />
</ig:CellEditing>
</Behaviors>
</ig:EditingCore>
</Behaviors>
Upvotes: 0
Reputation: 947
I am with latest service release of 11.2. I tried:
protected void Button2_Click(object sender, EventArgs e)
{
TextBox text = WebDataGrid1.Rows[0].Items[0].FindControl("TextBox1") as TextBox;
var rrr = text.Text;
}
and it works fine :) where my grid is called WebDataGrid1 and first column is templated containing TextBox named Text:
<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>
I tested it with IE 9 :)
Upvotes: 2