Imports System
Imports System.Data
Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
Dim mydts As New DataSet
Dim myclasscnn As New ctlconnection
Dim mytbname As String = "customers"
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Call loaddata
Call addcolumntodropdownlist
End Sub
Private Sub loaddata
Dim mycmd As New SqlCommand
mycmd = fnccmdcustomerlist(DropDownList1.Text, TextBox2.Text)
mydts = myclasscnn.fncreaddata(mydts, mycmd, mytbname)
End Sub
Private Sub addcolumntodropdownlist
For Each myClmn As DataColumn In mydts.Tables(mytbname).Columns
DropDownList1.Items.Add(myClmn.ColumnName)
Next
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
Call loaddata
GridView1.DataSource = mydts
GridView1.DataMember = mytbname
GridView1.DataBind
End Sub
Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged
dim myrow as integer = gridview1.selectedindex
dim grdvrow as gridviewrow = gridview1.rows(myrow)
dim mylinkbutton as linkbutton = ctype(grdvrow.findcontrol("linkbutton1"),linkbutton)
dim mycustomerid as string =mylinkbutton.text
response.redirect("default2.aspx?customerid=" & mycustomerid)
' TextBox1.Text = Request.QueryString("customerid")
End Sub
End Class
|