datagrid with no rows

Discussion in 'ASP .Net' started by kgs, Nov 14, 2003.

  1. kgs

    kgs Guest

    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
     
    kgs, Nov 14, 2003
    #1
    1. Advertising

  2. kgs

    vijay Guest

    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" <> wrote in message news:<439f01c3aae4$788c1e60$>...
    > 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
     
    vijay, Nov 14, 2003
    #2
    1. Advertising

  3. kgs

    Guest Guest

    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" <> wrote in

    message news:<439f01c3aae4$788c1e60$>...
    >> 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

    >.
    >
     
    Guest, Nov 18, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Subba Rao via DotNetMonster.com

    script for moving rows up and down and traverse thru rows of HTML table

    Subba Rao via DotNetMonster.com, Mar 19, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    8,248
    Subba Rao via DotNetMonster.com
    Mar 19, 2005
  2. helpful sql
    Replies:
    0
    Views:
    824
    helpful sql
    May 19, 2005
  3. Arjen Hoekstra
    Replies:
    0
    Views:
    567
    Arjen Hoekstra
    Aug 2, 2005
  4. Jason James

    Rows the rows of a grid view?

    Jason James, Aug 10, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    401
    Jason James
    Aug 10, 2006
  5. VijayRama
    Replies:
    2
    Views:
    2,336
    Gregory A. Beamer
    Oct 12, 2009
Loading...

Share This Page