Partial Class _Default Inherits System.Web.UI.Page Dim objCls As New CommClass Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load End Sub Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim str As String = "Select SrNo,Name From Mst_Login order by Name" Dim ds As New DataSet() ds = objCls.GetDs(str) GridView1.DataSource = ds.Tables(0) GridView1.DataBind() End Sub Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridView1.RowCommand txt1.Text = e.CommandArgument End Sub Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound Try If e.Row.RowType = DataControlRowType.DataRow Then Dim LnkTest As New LinkButton() LnkTest.ID = "myID" LnkTest.CommandArgument = e.Row.Cells(0).Text LnkTest.Text = e.Row.Cells(0).Text AddHandler LnkTest.Click, AddressOf GridView1_RowCommand e.Row.Cells(0).Controls.Add(LnkTest) End If Catch ex As Exception End Try End Sub End Class
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)