i am not able bind data from edit item template to item template in datalist control on click of update command.I given my code below
<asp:DataList ID="DataList1" runat="server" Caption="Doctor1"
oneditcommand="DataList1_EditCommand" BackColor="White"
BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3"
Font-Bold="False" Font-Italic="False" Font-Overline="False"
Font-Strikeout="False" Font-Underline="False" ForeColor="Purple"
GridLines="Vertical" oncancelcommand="DataList1_CancelCommand"
onitemdatabound="DataList1_ItemDataBound"
onselectedindexchanged="DataList1_SelectedIndexChanged"
onupdatecommand="DataList1_UpdateCommand">
<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
<AlternatingItemStyle BackColor="#DCDCDC" />
<ItemStyle BackColor="#EEEEEE" ForeColor="Black" />
<EditItemTemplate>
<table style="width:100%;">
<tr>
<td>
Reg No</td>
<asp:TextBox ID="TbxRegNo" runat="server"></asp:TextBox>
</td>
</td>
</tr>
Patient
<asp:TextBox ID="TbxPatient" runat="server"></asp:TextBox>
Compliats</td>
<asp:TextBox ID="TbxCompliant" runat="server"></asp:TextBox>
Mob.No</td>
<asp:TextBox ID="TbxNo" runat="server"></asp:TextBox>
<td colspan="2">
<asp:LinkButton ID="button2" runat="server" CommandName="update"
onclick="button2_Click" Text="Update" />
<asp:LinkButton ID="button3" runat="server" CommandName="Cancel"
Text="Cancel" />
</table>
</EditItemTemplate>
<SelectedItemStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
<ItemTemplate>
<br />
<td colspan="3">
<asp:Label ID="Label3" runat="server"
Text='<%# DataBinder.Eval(Container.DataItem,"time") %>'></asp:Label>
<asp:Label ID="LblPatient" runat="server" ></asp:Label>
<asp:LinkButton ID="LinkButton3" runat="server" CommandName="select">Select</asp:LinkButton>
<asp:LinkButton ID="button3" runat="server" CommandName="edit" Text="Edit" />
</ItemTemplate>
</asp:DataList>
protected void DataList1_UpdateCommand(object source, DataListCommandEventArgs e)
{
DataTable dt = (DataTable)Session["time"];
string patient = ((TextBox)e.Item.FindControl("TbxPatient")).Text;
((Label)e.Item.FindControl("LblPatient")).Text = patient;
DataList1.EditItemIndex = -1;
DataList1.DataSource = dt;
DataList1.DataBind();
}
I can't get value of patient to item template.above code is not working.Please help me.can I do this?