Don`t know whether its a bug in Gridviews empty data template
-
Hi all, I am finding a tough time solving this problem, but i am not able to understand this weird functionality. I have a grid view in my aspx as: After binding to gridview and in case no data is fetched, the grid doesn`t show up the empty data template. When i checked the html generated , the grid view is generated as
There are no td tags generated.Where it should have been
Sorry!!! No Records Available.
what could be the problem:confused::confused::confused: When you fail to plan, you are planning to fail.
-
Hi all, I am finding a tough time solving this problem, but i am not able to understand this weird functionality. I have a grid view in my aspx as: After binding to gridview and in case no data is fetched, the grid doesn`t show up the empty data template. When i checked the html generated , the grid view is generated as
There are no td tags generated.Where it should have been
Sorry!!! No Records Available.
what could be the problem:confused::confused::confused: When you fail to plan, you are planning to fail.
-
Are you sure you are binding the grid, if not bind the gridview with empty datatable and you can see the row. Dim dt As DataTable = Nothing Grv_Loc_wise_stk.DataSource = dt Grv_Loc_wise_stk.DataBind()
samerh wrote:
Are you sure you are binding the grid,
Yes, of course. If my filter criteria satisfies with the data being fetched, i can see it in my gridview.I am binding to a datatable which is filled from my sql database. ie something like this
Grv_Loc_wise_stk.DataSource=sales.Get_Stock_data(item,frmdate,todate)
Grv_Loc_wise_stk.DataBind()where Get_Stock_data returns a datatable.
When you fail to plan, you are planning to fail.
-
samerh wrote:
Are you sure you are binding the grid,
Yes, of course. If my filter criteria satisfies with the data being fetched, i can see it in my gridview.I am binding to a datatable which is filled from my sql database. ie something like this
Grv_Loc_wise_stk.DataSource=sales.Get_Stock_data(item,frmdate,todate)
Grv_Loc_wise_stk.DataBind()where Get_Stock_data returns a datatable.
When you fail to plan, you are planning to fail.
Your code is correct when i copied that code into my editor and ran it on an empty dataset it produced the desired results. My only theory is that sales.Get_Stock_data(item,frmdate,todate) is somehow is not empty or populated with null values giving the impression that its not empty. I would check that portion of your code because what you've posted is correct and works on my end. Hope that helps.
Matthew Vass QA Analyst mvass@hostmysite.com HostMySite.com
-
Your code is correct when i copied that code into my editor and ran it on an empty dataset it produced the desired results. My only theory is that sales.Get_Stock_data(item,frmdate,todate) is somehow is not empty or populated with null values giving the impression that its not empty. I would check that portion of your code because what you've posted is correct and works on my end. Hope that helps.
Matthew Vass QA Analyst mvass@hostmysite.com HostMySite.com
tech603 wrote:
My only theory is that sales.Get_Stock_data(item,frmdate,todate) is somehow is not empty or populated with null values giving the impression that its not empty
well i executed the procedure in my sql with the filter parameters and it returned me no rows. That suggests that my datatable is empty. Here`s what i have done in my function...
` cmd = New SqlCommand cmd.Connection = con cmd.CommandText = "MyProc" Adding Parameters.... cmd.Parameters.Add(....... cmd.CommandType = CommandType.StoredProcedure adp = New SqlDataAdapter adp.SelectCommand = cmd ds = New DataSet adp.Fill(ds) return ds.Tables(0)`
I cant figure it out, where the problem is!!!!!!
When you fail to plan, you are planning to fail.