[Mono-list] ASP.NET bug?? (solved)
Pablo Baena
pbaena@uol.com.ar
Wed, 28 Apr 2004 18:39:40 -0300
Doesn't happen in latest CVS.
Pablo Baena wrote:
>Before I post a bug report, can you spot some stupid mistake in this code? Because the table that I'm querying has lots of records and it is showing only one.
>
>THanks
>
><html>
><script language="C#" runat="server">
>
> void BindGrid() {
> string connectionString = "server=localhost;database=somedatabase;user id=root;password=;";
>
> MySqlConnection dbcon;
> dbcon = new MySqlConnection(connectionString);
> dbcon.Open();
>
> string sql = "SELECT numero, nombre " +
> "FROM clientes";
>
> MySqlDataAdapter adapter = new MySqlDataAdapter(sql, dbcon);
> DataSet dataset = new DataSet ();
> adapter.Fill (dataset, "clientes");
>
> MyDataGrid.DataSource = dataset.Tables["clientes"].DefaultView;
> MyDataGrid.DataBind();
> ShowStats();
> }
>
> void Page_Load(Object sender, EventArgs e) {
> if (chk1.Checked) {
> MyDataGrid.PagerStyle.Mode=PagerMode.NumericPages;
> }
> else {
> MyDataGrid.PagerStyle.Mode=PagerMode.NextPrev;
> }
>
> BindGrid();
> }
>
> void MyDataGrid_Page(Object sender, DataGridPageChangedEventArgs e) {
> MyDataGrid.CurrentPageIndex = e.NewPageIndex;
>
> BindGrid();
> }
>
> void ShowStats() {
> lblCurrentIndex.Text = "CurrentPageIndex is " + MyDataGrid.CurrentPageIndex;
> lblPageCount.Text = "PageCount is " + MyDataGrid.PageCount;
> }
>
>
></script>
>
><body>
>
> <h3><font face="Verdana">Basic Paging with DataGrid</font></h3>
>
> <form runat=server>
>
> <ASP:DataGrid id="MyDataGrid" runat="server"
> AllowPaging="True"
> PageSize="10"
> PagerStyle-Mode="NumericPages"
> PagerStyle-HorizontalAlign="Right"
> PagerStyle-NextPageText="Next"
> PagerStyle-PrevPageText="Prev"
> OnPageIndexChanged="MyDataGrid_Page"
> BorderColor="black"
> BorderWidth="1"
> GridLines="Both"
> CellPadding="3"
> CellSpacing="0"
> Font-Name="Verdana"
> Font-Size="8pt"
> HeaderStyle-BackColor="#aaaadd"
> AlternatingItemStyle-BackColor="#eeeeee"
> />
>
> <p>
> <asp:Checkbox id="chk1" runat="server"
> Text="Show numeric page navigation buttons"
> Font-Name="Verdana"
> Font-Size="8pt"
> AutoPostBack="true"
> />
>
> <p>
> <table bgcolor="#eeeeee" cellpadding="6"><tr><td nowrap><font face="Verdana" size="-2">
>
> <asp:Label id="lblCurrentIndex" runat="server" /><br>
> <asp:Label id="lblPageCount" runat="server" /><br>
>
> </font></td></tr></table>
> </form>
>
></body>
></html>
>
>_______________________________________________
>Mono-list maillist - Mono-list@lists.ximian.com
>http://lists.ximian.com/mailman/listinfo/mono-list
>
>
>
>