.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

i want to show data in textbox from tha datalist when user click any row

Posted By: pooja     Posted Date: June 30, 2011    Points:5   Category :ASP.Net
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")

LinkButton id = (LinkButton)e.Item.FindControl("lnk");
Label c_type = (Label)e.Item.FindControl("cat");
TextBox1.Text = id.Text;
TextBox2.Text = c_type.Text;

and my source code is

<form id="form1" runat="server">

<asp:DataList ID="DataList1" runat="server" DataKeyField="ID"

<asp:LinkButton ID ="lnk" runat ="server" CommandName="edit" Text='<%# Eval("ID") %>' />

<asp:Label ID="cat" runat="server" Text='<%# Eval("cat_type") %>' />
<br />
<br />
<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]">

<br />


Author: Gowthammanju             
Posted Date: June 30, 2011     Points: 20   

hey please check out this project


u will find solution

Thanks & Regards,

Mark if the answer is true

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend