asp.net datalist update
<p>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</p>

<p>Code-behind.</p>

<pre><code>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();
}
</code></pre>

<p>ASPX Markup.</p>

<pre><code>&lt;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"&gt;
        &lt;FooterStyle BackColor="#CCCCCC" ForeColor="Black" /&gt;
        &lt;AlternatingItemStyle BackColor="#DCDCDC" /&gt;
        &lt;ItemStyle BackColor="#EEEEEE" ForeColor="Black" /&gt;
        &lt;EditItemTemplate&gt;
            &lt;table style="width: 100%;"&gt;
                &lt;tr&gt;
                    &lt;td&gt;
                        Reg No
                    &lt;/td&gt;
                    &lt;td&gt;
                        &lt;asp:TextBox ID="TbxRegNo" runat="server"&gt;&lt;/asp:TextBox&gt;
                    &lt;/td&gt;
                    &lt;td&gt;
                        &amp;nbsp;
                    &lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr&gt;
                    &lt;td&gt;
                        Patient
                    &lt;/td&gt;
                    &lt;td&gt;
                        &lt;asp:TextBox ID="TbxPatient" runat="server"&gt;&lt;/asp:TextBox&gt;
                    &lt;/td&gt;
                    &lt;td&gt;
                        &amp;nbsp;
                    &lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr&gt;
                    &lt;td&gt;
                        Compliats
                    &lt;/td&gt;
                    &lt;td&gt;
                        &lt;asp:TextBox ID="TbxCompliant" runat="server"&gt;&lt;/asp:TextBox&gt;
                    &lt;/td&gt;
                    &lt;td&gt;
                        &amp;nbsp;
                    &lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr&gt;
                    &lt;td&gt;
                        Mob.No
                    &lt;/td&gt;
                    &lt;td&gt;
                        &lt;asp:TextBox ID="TbxNo" runat="server"&gt;&lt;/asp:TextBox&gt;
                    &lt;/td&gt;
                    &lt;td&gt;
                        &amp;nbsp;
                    &lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr&gt;
                    &lt;td colspan="2"&gt;
                        &lt;asp:LinkButton ID="button2" runat="server" CommandName="update" OnClick="button2_Click"
                            Text="Update" /&gt;
                        &lt;asp:LinkButton ID="button3" runat="server" CommandName="Cancel" Text="Cancel" /&gt;
                    &lt;/td&gt;
                    &lt;td&gt;
                        &amp;nbsp;
                    &lt;/td&gt;
                &lt;/tr&gt;
            &lt;/table&gt;
        &lt;/EditItemTemplate&gt;
        &lt;SelectedItemStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" /&gt;
        &lt;HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" /&gt;
        &lt;ItemTemplate&gt;
            &lt;br /&gt;
            &lt;table style="width: 100%;"&gt;
                &lt;tr&gt;
                    &lt;td colspan="3"&gt;
                        &lt;asp:Label ID="Label3" runat="server" Text='&lt;%# DataBinder.Eval(Container.DataItem,"time") %&gt;'&gt;&lt;/asp:Label&gt;
                    &lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr&gt;
                    &lt;td colspan="3"&gt;
                        &lt;asp:Label ID="LblPatient" runat="server"&gt;&lt;/asp:Label&gt;
                    &lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr&gt;
                    &lt;td&gt;
                        &amp;nbsp;
                    &lt;/td&gt;
                    &lt;td&gt;
                        &lt;asp:LinkButton ID="LinkButton3" runat="server" CommandName="select"&gt;Select&lt;/asp:LinkButton&gt;
                        &lt;asp:LinkButton ID="button3" runat="server" CommandName="edit" Text="Edit" /&gt;
                    &lt;/td&gt;
                    &lt;td&gt;
                        &amp;nbsp;
                    &lt;/td&gt;
                &lt;/tr&gt;
            &lt;/table&gt;
        &lt;/ItemTemplate&gt;
&lt;/asp:DataList&gt;
</code></pre>

<p>I can't get value of patient to item template.above code is not working.Please help me.can I do this?</p>
