Hi,
I have a Data-grid which is getting value from two three drop -down to create Rows in it.These values are coming from Stored Procedures onto Grid using "Selected Rows" as Input parameters to that Stored procedure and getting 3 values in return from Stored Procedure in Infotable and finally that Infotable "All Date" is bind to Data Grid.
Now, I want to Delete selected row from that Grid on click of button. Again I'm using another Stored Procedure which will be called on click of button. Now "Selected Row" three values mapped to Input parameters of the service which is calling that Stored Procedure.but I got stuck here,how to display returning value from this 2nd stored procedure onto SAME data grid.
Please suggest any way out or any other alternative.
I just want to add some rows onto a Grid and Delete some selected rows from the same Grid,using Stored Procedures.
Hi Tarun Nayyar, We can attach only one data input to the grid.
I am not sure if I understand your requirement clearly. Following is my suggestion based on my understanding:
You need to create first service/procedure to get data and second one to delete the selected row. Bind the output of first one as input to the grid.
Now on click of button invoke the second service to delete the selected data. Additionally, on ServiceInvokeCompleted of second service call the first service so that you have the latest updated data available via the first service which will be updated automatically in the grid.
I hope it helps.
Thanks,
Ankit Gupta
Thanks Ankit for your reply.
But scenario is different on my end.
I'm using two Stored Procedures as Assign SP and UnAssign SP for data.
- Assign SP will get input parameters from selected Drop Down List and will return values from Database,into result as Infotable....which I will bind to DataGrid.
- Now,User select one Row from DataGrid and based on selection of Row, values in that Row should be stored into the database through UnAssign SP. Also,that selected row should be removed.
So,This way same DataGrid will get populated from list data and selected row data should be stored in database and get removed at same time.
Use a session variable. Write a service that takes the input of your stored procedure and returns an infotable which you use to bind to the datagrid. Your code to call AssignSP and UnAssignSP will simply pass the results of the stored procedures to your new service and the datagrid will update accordingly. There is another post on the forum regarding using session variables to manage data being viewed in a datagrid.
Thanks Wayne for reply but I didn't want to use session due to some strict requirements.
I found another way of using a common service to fetch rows from DB based on Inputs and call it on service Invoke completed of First button and second button. This way 1st click will send inputs and fetch rows,on its Invoke common service will fetch common rows and similar for 2nd click.
Hence grid will get updated with latest data in Database,
I use two services to accomplish something like this.
This allows me to always have my last table values as an input so I can manipulate them as needed.