Dear All pls check this code and tell where the error
i m populate datalist and when click the user on datalist row
then show the selected item on textbox
pls check this
protected void DataList1_EditCommand(object source, DataListCommandEventArgs e)
{
if (e.CommandName == "Edit")
{
Label id = (Label)e.Item.FindControl("lnk");
Label c_type = (Label)e.Item.FindControl("cat");
TextBox1.Text = id.Text;
TextBox2.Text = c_type.Text;
}
}
And this the shource code
<body>
<form id="form1" runat="server">
<div>
<asp:DataList ID="DataList1" runat="server" DataKeyField="ID"
DataSourceID="AccessDataSource1">
<ItemTemplate>
<asp:LinkButton ID ="lnk" runat ="server" CommandName="edit" Text='<%# Eval("ID") %>' />
<asp:Label ID="cat" runat="server" Text='<%# Eval("cat_type") %>' />
<br />
<br />
</ItemTemplate>
</asp:DataList>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/blog.mdb" SelectCommand="SELECT * FROM [content]">
</asp:AccessDataSource>
<br />
</div>
</form>
</body>
thanks