H
hansiman
I have a real hard time figuring out how to handle/reference
submissions in the datagrid OnUpdateCommand. I've been through quite a
few tutorials....
The datagrid columns
<Columns>
<asp:BoundColumn Visible="False" DataField="EmployeeID"
HeaderText="EmployeeID"></asp:BoundColumn>
<asp:EditCommandColumn ButtonType="LinkButton"
UpdateText="update" CancelText="cancel' EditText="edit">
</asp:EditCommandColumn>
<asp:TemplateColumn SortExpression="Employee"
HeaderText="Employee">
<ItemTemplate>
<asp:Label runat="server"
Text='<%# DataBinder.Eval(Container, "DataItem.Employee") %>'>
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server"
ID="Employee"
Text='<%# DataBinder.Eval(Container, "DataItem.Employee") %>'>
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn SortExpression="EmployeeGroup"
HeaderText="Employee Group;">
<ItemTemplate>
<asp:Label runat="server"
Text='<%# DataBinder.Eval(Container, "DataItem.EmployeeGroup") %>'>
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<aspropDownList Runat="server" ID="cboEmployeeGroup"
DataSource="<%# GetEmployeeGroup() %>"
DataTextField="EmployeeGroup" DataValueField="EmployeeGroup">
</aspropDownList>
</EditItemTemplate>
</asp:TemplateColumn>
In another datagrid (with no template columns) I can successfulley
handle submissions this way:
Dim iEmployeeID As Integer = dg.DataKeys(e.Item.ItemIndex)
Dim TextBoxName As TextBox = e.Item.Cells(2).Controls(0)
Dim TextBoxEmail As TextBox = e.Item.Cells(3).Controls(0)
Dim sName As String = TextBoxName.Text
Dim sEmail As String = TextBoxEmail.Text
But it doesn't work this time around.
Please point me in the right direction
/Morten
submissions in the datagrid OnUpdateCommand. I've been through quite a
few tutorials....
The datagrid columns
<Columns>
<asp:BoundColumn Visible="False" DataField="EmployeeID"
HeaderText="EmployeeID"></asp:BoundColumn>
<asp:EditCommandColumn ButtonType="LinkButton"
UpdateText="update" CancelText="cancel' EditText="edit">
</asp:EditCommandColumn>
<asp:TemplateColumn SortExpression="Employee"
HeaderText="Employee">
<ItemTemplate>
<asp:Label runat="server"
Text='<%# DataBinder.Eval(Container, "DataItem.Employee") %>'>
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server"
ID="Employee"
Text='<%# DataBinder.Eval(Container, "DataItem.Employee") %>'>
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn SortExpression="EmployeeGroup"
HeaderText="Employee Group;">
<ItemTemplate>
<asp:Label runat="server"
Text='<%# DataBinder.Eval(Container, "DataItem.EmployeeGroup") %>'>
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<aspropDownList Runat="server" ID="cboEmployeeGroup"
DataSource="<%# GetEmployeeGroup() %>"
DataTextField="EmployeeGroup" DataValueField="EmployeeGroup">
</aspropDownList>
</EditItemTemplate>
</asp:TemplateColumn>
In another datagrid (with no template columns) I can successfulley
handle submissions this way:
Dim iEmployeeID As Integer = dg.DataKeys(e.Item.ItemIndex)
Dim TextBoxName As TextBox = e.Item.Cells(2).Controls(0)
Dim TextBoxEmail As TextBox = e.Item.Cells(3).Controls(0)
Dim sName As String = TextBoxName.Text
Dim sEmail As String = TextBoxEmail.Text
But it doesn't work this time around.
Please point me in the right direction
/Morten