Click here to Skip to main content
15,904,339 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
Can i call more then One Store Procedure for a grid-view depending on the drop-down list selected item?
I'm working on Asp.net(VS 2012) and SQL SERVER 2008 R2
Thanks in advance... :)
Posted

1 solution

Hi Sumit,
You can call as many as stored procedure for an event but the datasource that binds to the Grid View has to be one. This totally depends on how you write your logic.

you can use the dropdown_selectedindexchange event and based on the index or value that the user clicks you call the specific Logic/Stored procedure.

If you want to use data from two different list then you have to combine both the datatables and then assign that to the grid View. I hope you understant what I describe here.

Thanks,
Prasath S J
 
Share this answer
 
Comments
SumitChandra 16-Dec-13 2:43am    
Thanks Prasaad for your time....
Yes i got your logic, but still have a query... what will be the codes in the cs file for the dropdown_selectedindexchange event?
can you give me some example or any Syntax?
Prasaad SJ 16-Dec-13 4:26am    
The following is the dummy example from the link
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listcontrol.selectedindexchanged(v=vs.110).aspx

<asp:RadioButtonList id="RadioButtonList1"
OnSelectedIndexChanged="Index_Changed"
AutoPostBack="true"
runat="server"/>

in .cs file:
void Index_Changed(Object sender, EventArgs e) {

Label1.Text = "You selected " + RadioButtonList1.SelectedItem.Text +
" with a value of $" + RadioButtonList1.SelectedItem.Value +
".";

}

In the above function based on the value selected you can call the function.

eg if(RadioButtonList1.SelectedItem.Value=="Something")
{
//your function/SP
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900