Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > GridView Empty Cells

Reply
Thread Tools

GridView Empty Cells

 
 
Krish
Guest
Posts: n/a
 
      01-11-2006
******- I just posted this in asp.net newsgroup and realized i should have
posted here ********
Hello,

I have GridView and after binding data i can see cells empty only (empty row
is created), but i checked database there is data available. I just started
using GridView, trying to learn after using DataGrid, pardon my ignorance.
Here is the code.

public void ImageButtonSubmit(object sender, ImageClickEventArgs e)
{
string SQL;
DataSet ds = new DataSet();
string pMajor = cboMajor.SelectedValue;
SQL = "SELECT distinct M.cd_major,
M.cd_cipfamily,M.cd_cipcode,ds_ciptitle as ds_cipdesc,
M.in_translate,M.dt_trans_expire FROM km_major_cip M, km_etran_CIP F,
km_reference R where R.cd_type='MAJOR' and R.cd_value='" + pMajor + "' and
M.cd_major= R.cd_value and M.cd_cipcode=F.cd_cipcode and
M.cd_cipfamily=F.cd_cipfamily
MaintenanceCode mCode = new MaintenanceCode();
ds = mCode.GetMajor(SQL);
GridView1.DataSource = ds.Tables["Join10"];
GridView1.DataBind();
}


public DataSet GetMajor(string selectSQL)
{
OdbcConnection cn = new OdbcConnection("DSN=myodbcConn;");
cn.Open();
DataSet ds = new DataSet();
OdbcDataAdapter Ada = new OdbcDataAdapter();
OdbcCommand sCmd = new OdbcCommand(selectSQL, cn);
Ada.SelectCommand = sCmd;
cn.Close();
Ada.Fill(ds, "Join10");
return ds;
}

<asp:GridView ID="GridView1" runat="server"
AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
CssClass="body" ToolTip="Major Code" Width="99%" BackColor="White"
Font-Bold="False" ForeColor="Transparent" DataKeyNames="cd_major">
<EmptyDataRowStyle BackColor="Silver" />
<Columns>
<asp:TemplateField HeaderText="Major Code
&amp; Desc."></asp:TemplateField>
<asp:BoundField HeaderText="CIP Family" />
<asp:BoundField HeaderText="CIP Code" />
<asp:BoundField HeaderText="CIP Description"
/>
<asp:TemplateField HeaderText="Code
Translate"></asp:TemplateField>
<asp:TemplateField HeaderText="Dt.
Expire"></asp:TemplateField>
<asp:ButtonField HeaderText="Delete"
ImageUrl="~/Images/delitemGrid.gif" ButtonType="Image" />
<asp:ButtonField HeaderText="Edit"
ImageUrl="~/Images/editgrid.gif" ButtonType="Image" />
</Columns>
<AlternatingRowStyle BackColor="Lavender"
BorderColor="Blue" BorderStyle="None" />
<RowStyle BackColor="Transparent"
CssClass="body" ForeColor="Transparent" />
<EditRowStyle BackColor="White" />
<HeaderStyle BackColor="Transparent" />
</asp:GridView>
Any ideas ???





 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Empty gridview cells and checking for empty string Savvoulidis Iordanis ASP .Net 1 09-05-2008 06:15 AM
Gridview selecteditem.cells(x) - empty become "&nbsp;" K B ASP .Net 1 02-21-2008 04:14 PM
convert yyyymmdd text cells into date cells =?Utf-8?B?ZF9jYW1wZWxvQGhvdG1haWwuY29t?= Microsoft Certification 2 11-22-2006 04:52 PM
Writing to Cells in the Detailsview Insertmode makes cells uneditable. SixStringSlaya@gmail.com ASP .Net 0 02-28-2006 10:23 PM
GridView Empty Cells Krish ASP .Net 0 01-11-2006 10:18 PM



Advertisments