Gridview

  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Gridview as PDF for free.

More details

  • Words: 140
  • Pages: 1
Imports System.Data.SqlClient Imports System.Data Partial Class Parts Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Call PopulateGrid("select itemno,itemnamea,saleprice,lowprice,qtyend from tbl_item where qtyend>0 and brancode=" & CType(Session("branchcode"), Int32)) End Sub Private Sub PopulateGrid(ByVal sql As String) Using MyConnection As New SqlConnection(Session("constr")) Try MyConnection.Open() Dim cmd As New SqlCommand(sql) cmd.CommandType = CommandType.Text cmd.Connection = MyConnection Dim da As New SqlDataAdapter(cmd) Dim ds As New DataSet da.Fill(ds, "tbl_item") With gridview1 .DataSource = ds .DataMember = ds.Tables(0).TableName .DataBind() ' .Caption = " Stock On Hand " & (Session("branchname")) End With Catch ex As Exception MsgBox(ex.Message) Finally MyConnection.Close() MyConnection.Dispose() End Try End Using End Sub 'Protected Sub GridView1_PageIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.PageIndexChanged 'End Sub 'Protected Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles GridView1.PageIndexChanging ' GridView1.PageIndex = e.NewPageIndex 'End Sub End Class

Related Documents