Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > datagrid with no rows

Reply
Thread Tools

datagrid with no rows

 
 
kgs
Guest
Posts: n/a
 
      11-14-2003
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






 
Reply With Quote
 
 
 
 
vijay
Guest
Posts: n/a
 
      11-14-2003
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" <(E-Mail Removed)> wrote in message news:<439f01c3aae4$788c1e60$(E-Mail Removed)>...
> 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

 
Reply With Quote
 
 
 
 
Guest
Posts: n/a
 
      11-18-2003
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" <(E-Mail Removed)> wrote in

message news:<439f01c3aae4$788c1e60$(E-Mail Removed)>...
>> 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

>.
>

 
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
Hide the Gridview Rows and Header rows in Button click VijayRama ASP .Net 2 10-12-2009 01:58 PM
Rows the rows of a grid view? Jason James ASP .Net 0 08-10-2006 09:24 PM
dynamically add new rows and save data typed in these rows to a database Arjen Hoekstra ASP .Net 0 08-02-2005 12:15 PM
convert rows to columns and columns to rows helpful sql ASP .Net 0 05-19-2005 06:03 PM
script for moving rows up and down and traverse thru rows of HTML table Subba Rao via DotNetMonster.com ASP .Net 0 03-19-2005 06:46 AM



Advertisments