473,406 Members | 2,352 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

GridView Empty Cells

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 ???


Jan 11 '06 #1
0 1107

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jon S via DotNetMonster.com | last post by:
HI all, I'm returning a dataset to a gridview control. When the gridview asp.net control is populated from the returning dataset some of the cells remain empty. This is expected as some data...
0
by: den 2005 | last post by:
Hi everybody, I created a Gridview with a TemplateField and there is Label control in ItemTemplate and a DropdownList control in EditItemTemplate, I was to displayed them ok when I click the...
3
by: igotyourdotnet | last post by:
How can I add a empty row to my gridview? example: column 1 column2 row 1 row2 row3 row4 empty row across the grid row5
1
by: =?Utf-8?B?Q2hyaXM=?= | last post by:
Hi, I have a gridview which I added a <asp:CommandField EditText="E" CancelText="C" UpdateText="U" ButtonType="Link" ShowEditButton="True" /> my gridview looks like this <asp:GridView...
4
by: =?Utf-8?B?Vmlua2k=?= | last post by:
Hello Everyone, I have a gridview. I am using template columns inside the gridview. When I display the gridview on the web page and if there is no value in a particular cell, gridline disappaers...
5
by: bbawa1 | last post by:
I have a GetData methd which is returning a table using
2
by: desinerd | last post by:
Hi All. I am using a GridView to List contacts linked to a logged in User. I can successfully bind the Gridview with a DataTable. And the values in the GridView are correctly displayed. I...
1
nitindel
by: nitindel | last post by:
Hi All, Please tell me any good site for Gridview control.(not for datagrid). I am facing error in fetching the values of the Bound columns in the gridview: lease tell me how should i...
7
by: =?Utf-8?B?SnVsaWEgQg==?= | last post by:
Hi all, this is a second post, so apologies, but I never had an answer to my first post (several weeks ago) and I really need some help. I'm using a .Net 2.0 Gridview which is populated using an...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.