473,396 Members | 1,853 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,396 software developers and data experts.

datagrid with no rows

kgs
I get argument out of range exception when my datasource
does not have any rows to display in datagrid.
what should i do to display header only
without any rows. Right now if there are no rows i get a
blank area of datagrid. no header no footers.

here is the snippet of code.

Try

mydataGrid.DataSource = myDS
mydataGrid.DataBind()
Catch
--No rows. just display only header.
End Try


Nov 17 '05 #1
2 1938
You modify your code as
Try
MyAdapter.SelectCommand = myDataCommand;
MyDataAdapter.fill(myDs,"myRows")
mydataGrid.DataSource = myDS.Tables("myRows").DefaultView
mydataGrid.DataBind()
Catch
--No rows. just display only header.
End Try


"kgs" <an*******@discussions.microsoft.com> wrote in message news:<43****************************@phx.gbl>...
I get argument out of range exception when my datasource
does not have any rows to display in datagrid.
what should i do to display header only
without any rows. Right now if there are no rows i get a
blank area of datagrid. no header no footers.

here is the snippet of code.

Try

mydataGrid.DataSource = myDS
mydataGrid.DataBind()
Catch
--No rows. just display only header.
End Try

Nov 18 '05 #2
Thanks Vijay. I still get datagrid with no header. I
cannot access the header info
-----Original Message-----
You modify your code as
Try
MyAdapter.SelectCommand = myDataCommand;
MyDataAdapter.fill(myDs,"myRows")
mydataGrid.DataSource = myDS.Tables("myRows").DefaultView
mydataGrid.DataBind()
Catch
--No rows. just display only header.
End Try


"kgs" <an*******@discussions.microsoft.com> wrote in

message news:<43****************************@phx.gbl>...
I get argument out of range exception when my datasource does not have any rows to display in datagrid.
what should i do to display header only
without any rows. Right now if there are no rows i get a blank area of datagrid. no header no footers.

here is the snippet of code.

Try

mydataGrid.DataSource = myDS
mydataGrid.DataBind()
Catch
--No rows. just display only header.
End Try

.

Nov 18 '05 #3

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

Similar topics

1
by: Soul | last post by:
*** I am not sure this question belong to *.languages.csharp or *.framework.windowsdorms.databinding, so I post to both *** Hi, Currently I have a DataGrid which bind to a DataSet. One of...
5
by: BBFrost | last post by:
Win2000 ..Net 1.1 SP1 c# using Visual Studio Ok, I'm currently in a "knock down - drag out" tussle with the .Net 1.1 datagrid. I've come to realize that a 'block' of rows highlighted within...
3
by: Carolyn Vo | last post by:
I have a datagrid in my web control class that I am trying to get the current rows displayed for. I have enabled paging on the datagrid so if the user is currently on page 3 of 8, and if I have...
4
by: Glenn Owens | last post by:
I have a DataGrid web control which I've dynamically populated with template columns to be used for bulk-editting. Generally, all of the columns are textbox and/or dropdownlist child controls. ...
2
by: CSL | last post by:
I am using the DataGrid in a Windows Application, how can I adjust the widths of each column individually.
5
by: Genojoe | last post by:
I am using code from Help with two exceptions. (1) I increased the number of sample rows from 3 to 20, and (2) I anchored the datagrid to bottom of form so that I can change the size of the grid by...
8
by: Richard L Rosenheim | last post by:
I have a dataset containing a parent table related to a child table. The child table contains an ID field (which is configured as autonumber in the datatable), the ID of the parent, plus some...
4
by: Jan Nielsen | last post by:
Hi all I'm a former Access developer who would like to implement a many-to-many relation in about the same way you do in Access: With a subform and a combo box. Is it possible to use a...
0
by: Matt | last post by:
I derived my own custom class from the datagrid class. I overrode the ProcessCmdKey Function, like this, to catch the up and down arrow keys: ====== Protected Overrides Function...
0
by: rn5a | last post by:
All the rows in a DataGrid are accompanied by a CheckBox. When a user checks the rows & clicks a Button, the checked rows get deleted. For e.g. assume that the DataGrid displays 10 rows. A user...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.