Imports System.Text
Imports System.Text.StringBuilder
Imports System.IO
Imports System.Drawing
Public Class CarDetail
Inherits System.Web.UI.Page
Dim conn As New dbConn
Dim fileName As String = "Brand_report.xls"
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
System.Threading.Thread.CurrentThread.CurrentCulture = New System.Globalization.CultureInfo("en-US", False)
If Not IsPostBack Then
LoadDDL()
LoadData()
End If
PnlBrand.Visible = False
pnlAdd.Visible = True
pnlUpdate.Visible = False
PnlDelect.Visible = False
End Sub
Public Sub LoadData()
GridView1.DataSource = conn.GetDataTable("Select BrandName as ยี่ห้อ From CarBrand", "CarBrand")
GridView1.DataBind()
End Sub
Public Sub LoadDDL()
ddlDeleteBrand.DataSource = conn.GetDataTable("Select BrandName From CarBrand", "brand")
ddlDeleteBrand.DataTextField = "BrandName"
ddlDeleteBrand.DataValueField = "BrandName"
ddlDeleteBrand.DataBind()
ddlUpdateBrand.DataSource = conn.GetDataTable("Select BrandName From CarBrand", "brand")
ddlUpdateBrand.DataTextField = "BrandName"
ddlUpdateBrand.DataValueField = "BrandName"
ddlUpdateBrand.DataBind()
End Sub
Protected Sub btnBrandFucntion_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnBrandFucntion.Click
If ddlBrandFunction.SelectedIndex = 0 Then
lblFunctionStatus.Text = "Please Select Function"
pnlFunction.Visible = True
ElseIf ddlBrandFunction.SelectedIndex = 1 Then
PnlBrand.Visible = True
pnlBrandData.Visible = False
pnlAdd.Visible = True
pnlUpdate.Visible = False
PnlDelect.Visible = False
ElseIf ddlBrandFunction.SelectedIndex = 2 Then
PnlBrand.Visible = True
pnlBrandData.Visible = False
pnlAdd.Visible = False
pnlUpdate.Visible = True
TxtUpDateBrand.Text = ""
PnlDelect.Visible = False
ElseIf ddlBrandFunction.SelectedIndex = 3 Then
PnlBrand.Visible = True
pnlBrandData.Visible = False
pnlAdd.Visible = False
pnlUpdate.Visible = False
PnlDelect.Visible = True
End If
End Sub
Protected Sub btnCommand_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnCommand.Click
If ddlMode.SelectedIndex = 0 Then
lblModetatus.Text = "Please Select Mode"
ElseIf ddlMode.SelectedIndex = 1 Then
lblModetatus.Text = "Brand mode"
PnlBrand.Visible = True
pnlBrandData.Visible = True
pnlUpdate.Visible = False
PnlDelect.Visible = False
pnlAdd.Visible = False
ElseIf ddlMode.SelectedIndex = 2 Then
lblModetatus.Text = "Model mode"
End If
End Sub
End Class
Tag : ASP.NET Ms SQL Server 2008, Web (ASP.NET), VB.NET