why i my GridView didn't exist on my website when i running the asp.net program?

  • Thread starter Thread starter wawi93
  • Start date Start date
W

wawi93

Guest
this is my aspx code..


<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site1.Master" CodeBehind="clubs.aspx.vb" Inherits="OnlineWebApplication.clubs" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div class="club">
<div class="reg">
<fieldset>
<legend></legend><br />
<h4>Register Club | High Committee</h4>
<asp:Label ID="Label1" runat="server" Text="Name"></asp:Label><br />
<asp:TextBox ID="TextBox1" runat="server" Width="377px"></asp:TextBox>
<br />
<asp:Label ID="Label2" runat="server" Text="Club title"></asp:Label><br />
<asp:TextBox ID="TextBox2" runat="server" Width="377px"></asp:TextBox>
<br />
<asp:Label ID="Label3" runat="server" Text="President"></asp:Label><br />
<asp:TextBox ID="TextBox3" runat="server" Width="377px"></asp:TextBox>
<br />
<asp:Label ID="Label4" runat="server" Text="Vice President"></asp:Label><br />
<asp:TextBox ID="TextBox4" runat="server" Width="377px"></asp:TextBox>
<br />
<asp:Label ID="Label5" runat="server" Text="Assistant"></asp:Label><br />
<asp:TextBox ID="TextBox5" runat="server" Width="377px"></asp:TextBox>
<br />
<asp:Label ID="Label6" runat="server" Text="Treasurer"></asp:Label><br />
<asp:TextBox ID="TextBox6" runat="server" Width="377px"></asp:TextBox>
<br />
<asp:Label ID="Label7" runat="server" Text="Captain"></asp:Label><br />
<asp:TextBox ID="TextBox7" runat="server" Width="377px"></asp:TextBox><br /><br />

<asp:Button ID="Button1" runat="server" Text="Register Now"></asp:Button>
<br /><br />

</fieldset>
</div>
<div class="list">
<asp:GridView ID="GridView1" runat="server" CellPadding="4" ForeColor="#333333" GridLines="Vertical" Height="288px" ShowFooter="True" Width="527px">
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
<EditRowStyle BackColor="#999999" />
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<SortedAscendingCellStyle BackColor="#E9E7E2" />
<SortedAscendingHeaderStyle BackColor="#506C8C" />
<SortedDescendingCellStyle BackColor="#FFFDF8" />
<SortedDescendingHeaderStyle BackColor="#6F8DAE" />

</asp:GridView>
</div>
</div>
</asp:Content>



and this is the code behind it...


Imports MySql.Data.MySqlClient
Imports System.Data
Imports System.Configuration

Public Class clubs
Inherits System.Web.UI.Page
Dim con As MySqlConnection
Dim rsl As Integer
Dim da As New MySqlDataAdapter
Dim result As Integer
Dim cmd As New MySqlCommand
Dim ds As DataSet
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Me.IsPostBack Then
BindData()
End If

End Sub
Public Sub BindData()
Dim conn As MySqlConnection = New MySqlConnection("Server=localhost;Port=3306;Database=online;Uid=root;Pwd=P@ssword;Pooling=true;")
Using (conn)
Dim adp As MySqlDataAdapter = New MySqlDataAdapter("SELECT * from club", conn)
Dim dt As DataTable = New DataTable()
adp.Fill(dt)
If (dt.Rows.Count > 0) Then
GridView1.DataSource = dt
GridView1.DataBind()
End If
End Using

End Sub


End Class




hope anyone can help me for this..

thank you :)

Continue reading...
 
Back
Top