Binding datasource to gridview as storedprocedure of DataContext object
-
Hi all, I have wrote a stored procedure to retrieve data fron Database. I added this stored procedure in .dbml file. I have assign the result of stored procedure to Gridview. I did like this Gridview1.DataSource = DataContextObj.StoredProcedureName(par1,par2,par3,par4); //All r input params only Gridview1.DataBind(); It returns nothing into Gridview. I think some thinhg went wrong in my code. There is nothing wrong in my StoredProcedure. I checked by passing parameters. It giving the result. Please help me.
-
Hi all, I have wrote a stored procedure to retrieve data fron Database. I added this stored procedure in .dbml file. I have assign the result of stored procedure to Gridview. I did like this Gridview1.DataSource = DataContextObj.StoredProcedureName(par1,par2,par3,par4); //All r input params only Gridview1.DataBind(); It returns nothing into Gridview. I think some thinhg went wrong in my code. There is nothing wrong in my StoredProcedure. I checked by passing parameters. It giving the result. Please help me.
Have you set autogeneratecolumns = true in the gridview? Does the StoredProcedure return a specific type of object?
'Howard
-
Have you set autogeneratecolumns = true in the gridview? Does the StoredProcedure return a specific type of object?
'Howard
Yes i set it to true.
-
Yes i set it to true.
Try putting the stored procedure output in a temporary variable, and debug the code at that point to see if there is any data returned, before you assign to the .DataSource
'Howard
-
Try putting the stored procedure output in a temporary variable, and debug the code at that point to see if there is any data returned, before you assign to the .DataSource
'Howard
Thanks for ur reply, I tried that one also. var temp = DataContextObj.SP_Name(par1,par2,par3); // Here i am getting '0', But when i execute my SP in SQL Management Studio i am getting records. Gridview1.DataSource = temp; Gridview1.DataBind(); any suggestions...
-
Thanks for ur reply, I tried that one also. var temp = DataContextObj.SP_Name(par1,par2,par3); // Here i am getting '0', But when i execute my SP in SQL Management Studio i am getting records. Gridview1.DataSource = temp; Gridview1.DataBind(); any suggestions...
- maybe the SP is returning the record count? 2) try delete and reimport the SP from the database to ensure the definition is correct
'Howard