I have one form having One DataList In which i have two table one having Header Template and other having Item Template.......
Code Of aspx page is as follows.....
<asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource1">
<HeaderTemplate>
<div>
<table>
<tr>
<td style="width:245px; text-align:center;">
Image</td>
<td style="width:450px;text-align:center;">
Item Description</td>
<td style="width:260px;text-align:center;">
Price</td>
<td style="width:322px;text-align:center;">
Qty</td>
<td style="width:300px;text-align:center;">
Remove</td>
<td style="width:310px;text-align:center;">
Total</td>
</tr>
</table>
</div>
</HeaderTemplate>
<ItemTemplate>
<div>
<table class="style1" style="border:solid 3px purple">
<tr>
<td style="width:200px;border: thin ridge #FF00FF;">
<asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("Product_Image") %>' Height="100px" Width="100px" />
</td>
<td style="width:500px;border: thin ridge #FF00FF;">
<asp:Label ID="Item_DescriptionLabel" runat="server"
Text='<%# Eval("Item_Description") %>' />
</td>
<td style="width:300px;border: thin ridge #FF00FF;text-align:center; ">
<asp:Label ID="PriceLabel" runat="server" Text='<%# Eval("Price") %>' />
</td>
<td style="width:300px;border: thin ridge #FF00FF;">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Label ID="QtyLabel" runat="server" Text='<%# Eval("Qty") %>' />
<br>
<br></br>
<asp:LinkButton ID="LinkButton1" runat="server">Change</asp:LinkButton>
</br>
</td>
<td style="width:300px;border: thin ridge #FF00FF;">
<asp:ImageButton ID="ImageButton1" runat="server" />
</td>
<td style="width:300px;border: thin ridge #FF00FF;">
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</td>
</tr>
</table>
</div>
</ItemTemplate>
</asp:DataList>
As you can see there is a td tag having one label,textbox and linkbutton
<td style="width:300px;border: thin ridge #FF00FF;">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Label ID="QtyLabel" runat="server" Text='<%# Eval("Qty") %>' />
<br>
<br></br>
<asp:LinkButton ID="LinkButton1" runat="server">Change</asp:LinkButton>
</br>
</td>
Now on this LinkButton click i want to make visibility of textbox to true bydefault it will be false and also the linkbutton text to Save............
cs file code............
if (Session["Customer_ID"] == null)
{
Response.Redirect("LogIn.aspx");
}
else
{
string id = Session["Customer_ID"].ToString();
SqlConnection con = new SqlConnection();
con.ConnectionString = "Data Source=HP-HP\\SQLEXPRESS;Initial Catalog=OnlineShop;Persist Security Info=True;User ID=sa;Password=rane@1234";
con.Open();
SqlCommand cmd = new SqlCommand("select * from Cart where Customer_ID='"+id+"'", con);
SqlDataReader dr = cmd.ExecuteReader();
DataTable dt = new DataTable();
dt.Load(dr);
DataList1.DataSourceID = null;
DataList1.DataSource = dt;
DataList1.DataBind();
con.Close();
}