469,920 Members | 2,388 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,920 developers. It's quick & easy.

GridView Empty Cells


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
MaintenanceCode mCode = new MaintenanceCode();
ds = mCode.GetMajor(SQL);
GridView1.DataSource = ds.Tables["Join10"];
public DataSet GetMajor(string selectSQL)
OdbcConnection cn = new OdbcConnection("DSN=myodbcConn;");
DataSet ds = new DataSet();
OdbcDataAdapter Ada = new OdbcDataAdapter();
OdbcCommand sCmd = new OdbcCommand(selectSQL, cn);
Ada.SelectCommand = sCmd;
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" />
<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
<asp:TemplateField HeaderText="Dt.
<asp:ButtonField HeaderText="Delete"
ImageUrl="~/Images/delitemGrid.gif" ButtonType="Image" />
<asp:ButtonField HeaderText="Edit"
ImageUrl="~/Images/editgrid.gif" ButtonType="Image" />
<AlternatingRowStyle BackColor="Lavender"
BorderColor="Blue" BorderStyle="None" />
<RowStyle BackColor="Transparent"
CssClass="body" ForeColor="Transparent" />
<EditRowStyle BackColor="White" />
<HeaderStyle BackColor="Transparent" />
Any ideas ???

Jan 11 '06 #1
0 1010

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Jon S via DotNetMonster.com | last post: by
3 posts views Thread by igotyourdotnet | last post: by
1 post views Thread by =?Utf-8?B?Q2hyaXM=?= | last post: by
4 posts views Thread by =?Utf-8?B?Vmlua2k=?= | last post: by
5 posts views Thread by bbawa1 | last post: by
1 post views Thread by nitindel | last post: by
7 posts views Thread by =?Utf-8?B?SnVsaWEgQg==?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.