how to show empty row on grid view in asp.net
I have a grid view that contain 25 records, in page size property set to 10 records per page. It have 3 pages, in the final page it displays only 5 rows, Here it show 10 rows. (First five records then next five as empty rows) Please post the help.
Manoj Kumar MandalPosted Apr 28, 2015, 6:20 AM
Try this code
int rowcount = dt.Rows.Count;
int remainingCount = 10 - (rowcount % 10) ;
for (int i = 0; i < remainingCount; i++)
{
DataRow row = dt.NewRow();
dt.Rows.Add(row);
}
Manoj Kumar MandalPosted May 11, 2015, 3:34 AM
Sample Code
protected void DropDownList1_SelectedIndexChanging(object sender, EventArgs e)
{
int TypeId= Convert.ToInt32(DropDownList1.SelectedValue);
//Call your procedure with TypeId as argument
}
Inside Procedure use condition
IF (TypeId = 1 )
BEGIN
//Query to fetch data of School
END
ELSE IF (TypeId = 2)
BEGIN
//Query to fetch data of College
END
ELSE
BEGIN
//Query to fetch data of Office
END
ashok kumarPosted May 11, 2015, 1:36 AM
I have one dropdownlist which contain value of school and office i have also table in school and office i have also grid. when i select school in dropdownlist the grid display must the school table and vivice-versa.
Thank You,
ashok kumarPosted Apr 28, 2015, 4:47 AM
Please Help me
Thanks in Advance
Sibeesh VenuPosted Apr 28, 2015, 4:29 AM
So you want to add 5 empty rows to the grid? If yes why don't you just add 5 extra rows to your data source and assign it. I could not find out any difficulty to do so. Please elaborate your question.
Please up vote and accept if it helps you.
Kindest Regards
Sibeesh Venu
www.sibeeshpassion.com