How to bind empty row to gridview?

Posted by Satyadnet under ASP.NET on 4/28/2009 | Views : 18040 | Status : [Member] | Replies : 8
Hi everyone,
Please let me know with the code .

Thanks..




Responses

Posted by: Guru.pm on: 8/13/2011 [Member] Starter | Points: 25

Up
0
Down
Hey Vuyiswamb ,
pls, help me...
I have some prob.,
I want to display 30 fixed records in 1st page in grideview, if not available then fill blank and set fixed size to first page.

Thanx in advance...

Satyadnet, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 4/28/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
Good Morning Satyadnet

Mybe you did not explain in Detail what you want to do. really why would you want to bind an empty row, you might as well not bind the grid at all. Please explain in detail what exactly do you want to achieve.

Thank you for Posting at Dotnetfunda

Were looking forward for your reply


Vuyiswa Maseko

Thank you for posting at Dotnetfunda
[Administrator]

Satyadnet, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Satyadnet on: 4/28/2009 [Member] Starter

Up
0
Down
Hi Vuyiswamb,
My question is suppose i have table has eid , ename fields which have
like

100 aaa
200 bbb

after that i want display , empty row in GridView.
I think u got, If not please let me know...

Satyadnet, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 4/29/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
Good Morning Satyadnet

I understand that you say you have


eid |ename
========
100 | aaa
200 | bbb


ok and you want to Bind it to the Grid , that is Simple and got lost when you say

after that i want display , empty row in GridView.


why?

Thank you For Posting at Dotnetfunda

Vuyiswa Maseko


Thank you for posting at Dotnetfunda
[Administrator]

Satyadnet, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Satyadnet on: 4/29/2009 [Member] Starter

Up
0
Down
Thanks for your valuable reply,
Because i was asked by an interviewer.
Thanks.

Satyadnet, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 4/29/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
You are Welcome :)

Thank you For Posting at Dotnetfunda

Vuyiswa Maseko

Thank you for posting at Dotnetfunda
[Administrator]

Satyadnet, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Satyadnet on: 4/29/2009 [Member] Starter

Up
0
Down
Please Provide me Code Mr Vuyiswa Maseko, How can i bind empty row to gridview.

Satyadnet, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Syedshakeer on: 5/15/2009 [Member] Starter

Up
0
Down
Hi staydnet;
the below code show a grid view with no data in a grid; create a empty DataTable and bind it to
GridView. e.g:

sing System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DataTable dt = new DataTable();
dt.Columns.Add("Name");
dt.Columns.Add("Description");

dt.Rows.Add(new object[] { "", "" });

GridView1.DataSource = dt;
GridView1.DataBind();

}
}


Syed Shakeer Hussain

Satyadnet, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response