Can anyone help me to solve this problem that I am facing with GridView in asp.net 3.5 ?
Following is the code: .aspx page:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="displaytabledata.aspx.cs" Inherits="diplaydata.displaytabledata" %>
and .aspx.cs code:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
// Application Import(s)
using images.Utilities;
namespace diplaydata
{
public partial class displaytabledata : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
bind();
}
}
private DataTable getTable()
{
OracleDataAdapter adap = new OracleDataAdapter("select t.id, t.author, t.description from smstestblob t", "Data Source=ds1;User ID=test;Password=test;");
DataTable dt = new DataTable();
adap.Fill(dt);
adap.Dispose();
return dt;
}
protected void bind()
{
DataTable dr = getTable();
gv_displaydata.DataSource = dr;
gv_displaydata.DataBind();
}
protected void gv_displaydata_PageIndexChanged(object sender, EventArgs e)
{
gv_displaydata.PageIndex = gv_displaydata.PageIndex + 1;
bind();
}
protected void gv_displaydata_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
{
gv_displaydata.PageIndex = gv_displaydata.PageIndex + 1;
bind();
}
protected void gv_displaydata_SelectedIndexChanged(object sender, EventArgs e)
{
gv_displaydata.PageIndex = gv_displaydata.PageIndex + 1;
bind();
}
protected void gv_displaydata_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gv_displaydata.PageIndex = gv_displaydata.PageIndex + 1;
bind();
}
}
}
No data is getting displayed in the GridView on both pages 1 and 2. And when I click on 2 page link, and then first page, 2nd page link is no longer clickable.
I am using Oracle 9i. And following is the table creation script:
SQL> CREATE TABLE SMSTestBlob
2 (
3 id number,
4 photo BLOB,
5 author varchar2(100),
6 description varchar2(500)
7 );
Table created.
SQL> alter table SMSTESTBLOB
2 add constraint PK_SMSTESTBLOB_ID primary key (ID);
Table altered.
SQL> create sequence smstestblobid_seq
2 minvalue 1
3 maxvalue 999999999999
4 start with 1
5 increment by 1
6 cache 20
7 cycle
8 order;
Sequence created.
*************************************************
If anyone can help on this, please do so on an urgent basis.
Thanks,
Regards,
Moksha
MokshasriPosted Dec 15, 2009, 5:40 AM
I am still struggling with this problem.
Thanks
MokshasriPosted Dec 13, 2009, 9:55 AM
If the answers contain examples then would be helpful.
If any one can help with a small working example, it would be of great help.
Thanks
Hiren SoniPosted Dec 13, 2009, 6:47 AM
index changing and index changed in this you call bind method. .eachtime if you wanna do that pass pageindex number in bind caliing.. And set gridview page index by that value...
MokshasriPosted Dec 13, 2009, 6:36 AM
And Autogeneratecolums to True generated repeated columns but without the image column.
Appreciate you quick help.
Thanks
Anwarul HaquePosted Dec 11, 2009, 6:22 AM
It should be display data in grid.
Baimey RajeshPosted Dec 10, 2009, 1:20 PM