Coding Cluster

ASP.NET Dynamic LinkButton using c#(Create dynamic html table in asp.net):
In this article I am explaining how to add Dynamic table with Dynamic LinkButton. In the design page, we just add how many controls we need and where it should be placed. These controls are static and having the data what we gave. In some cases we have to dynamically get data from the database and create dynamic controls for the data.

Creating Dynamic LinkButton in Asp.Net is simple one . After creating the dynamic controls just add the controls in a PlaceHolder or Panel control.

In the following sample, I'm created a html table with students name at run time. Here i'm created dynamic link for all students at the time of binding. The dynamic click event "lnkStudentDetails_Click" redirect to corresponding student details page.

In the Page_Load event, Call the load data method outside the IsPostBack() method. Because our dynamic controls should recreate each and every time when a postback call.

using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
publicpartialclass_Default : System.Web.UI.Page
{