Issue is the two methods contain two different sp's, the two sp's have different parameters when i execute the scenario the second method fires with a error as Procedure or function has too many arguments specified.
Can't find the problem, at least for second method call. Please tell us exactly which point you are getting this error. And please post your stored procedure's code if you can?
naveen kumar...
Member
149 Points
93 Posts
Dropdown issue
Jun 25, 2012 08:53 AM|LINK
Can We call more then one method in a dropdownlist selectedindexchanged event
master2080
Member
210 Points
265 Posts
Re: Dropdown issue
Jun 25, 2012 08:56 AM|LINK
Call a method from the selectedindexchanged event.
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { some_function(); }karang
Contributor
2441 Points
919 Posts
Re: Dropdown issue
Jun 25, 2012 08:56 AM|LINK
Hi
Yes you can. What is the issue you are facing?
Karan Gupta
http://gyansangrah.com
Please click "Mark as Answer" if this helped you.
ssjGanesh
Participant
1928 Points
1352 Posts
Re: Dropdown issue
Jun 25, 2012 08:57 AM|LINK
s u can like below...
dropdwn_OnIndexchange()
{
method1();
method2();
}
public void method1()
{}
public void method2()
{
}
Mark as answer,if it helped U!
mishra.bhupe...
Participant
1596 Points
378 Posts
Re: Dropdown issue
Jun 25, 2012 09:00 AM|LINK
Yes. But what type of method you want to call?
On the Index Change Evenmethod other method can be called as:
_SelectedIndexChanged(object sender, EventArgs e)
{
AnyotherEventMethod(Objec sender,EventArgs e)
}
In case of other methods you can have normal calls.
naveen kumar...
Member
149 Points
93 Posts
Re: Dropdown issue
Jun 25, 2012 09:06 AM|LINK
Issue is the two methods contain two different sp's, the two sp's have different parameters when i execute the scenario the second method fires with a error as Procedure or function has too many arguments specified.
mishra.bhupe...
Participant
1596 Points
378 Posts
Re: Dropdown issue
Jun 25, 2012 09:09 AM|LINK
Please post your code mehtods and sp's.
ssjGanesh
Participant
1928 Points
1352 Posts
Re: Dropdown issue
Jun 25, 2012 09:11 AM|LINK
I think u create parameters in the onchanged event.
If it so, change that like below.
dropdwn_OnIndexchange()
{
method1();
method2();
}
public void method1()
{
// Make parameters for this method and call SP.
}
public void method2()
{
// Make parameters for this method and call SP.
}
Now u can't get that error.
Mark as answer,if it helped U!
naveen kumar...
Member
149 Points
93 Posts
Re: Dropdown issue
Jun 25, 2012 09:14 AM|LINK
protected void ddlTimeOfCab_SelectedIndexChanged(object sender, EventArgs e) { GetNoOfSeatsAvailable(); GetCabTime(); } private void GetNoOfSeatsAvailable() { objUserVO.NewCabId = Convert.ToInt32(ddlTimeOfCab.SelectedValue); objUserVO.CabDate = DateTime.Now.Date; userDataSet = objUserServices.getCabAvailability(objUserVO); // Here the UserDataSet is Reteriving the Available No of Seats For a Particular Cab and the Status of the Particular User. if (userDataSet != null && userDataSet.Tables.Count > 0 && userDataSet.Tables[0].Rows.Count > 0) // Verifying Wheather the UserDataset is null and count Tables and count of rows in the Table. { foreach (DataRow row in userDataSet.Tables[0].Rows) { strNoOfSeatsAvailable = Convert.ToInt32(row["AVL"]); intUserID = Convert.ToInt32(row["UserID"]); if (intUserID.Equals(Session["UserId"])) // Checking Wheather the above reterived Dataset UserId and the logged in userid is equal or not and depending on that the Accept and Cancel Buttons are Enabled and Disabled. { btnAccept.Enabled = false; btnCancel.Enabled = true; } else { btnCancel.Enabled = false; btnAccept.Enabled = true; } } } Session["NewCabID"] = Convert.ToInt32(ddlTimeOfCab.SelectedValue); Session["NoOfSeatsAvailable"] = strNoOfSeatsAvailable; lblNoOfSeatsAvailable.Text = Convert.ToString(strNoOfSeatsAvailable) + " " + "Seats are available"; //objUserVO.Userid = Convert.ToInt32(Session["UserId"]); //userDataSet = objUserServices.getNewCabId(objUserVO); //if (userDataSet != null && userDataSet.Tables.Count > 0 && userDataSet.Tables[0].Rows.Count > 0) // Verifying Wheather the UserDataset is null and count Tables and count of rows in the Table. //{ // foreach (DataRow row in userDataSet.Tables[0].Rows) // { // intNewcabId = Convert.ToInt32(row["MSI_NewCabId"]); // } //} } private void GetCabTime() { objUserVO.NewCabId = Convert.ToInt32(ddlTimeOfCab.SelectedValue); objUserVO.CabName = ddlTimeOfCab.SelectedItem.ToString(); userDataSet = objUserServices.getCabTime(objUserVO); if (userDataSet != null && userDataSet.Tables.Count > 0 && userDataSet.Tables[0].Rows.Count>0) { foreach (DataRow row in userDataSet.Tables[0].Rows) { strTime = Convert.ToString(row["Cab_Time"]); lblTime.Text = strTime; } } } public DataSet getCabAvailability(UserVO objUserVO) { try { sqlconnection.Open(); userdataset.Tables.Clear(); sqlCommand.Connection = sqlconnection; sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.CommandText = "Cab_Usage_getAvailableSeats"; sqlCommand.Parameters.AddWithValue("@MSI_NewCabId", objUserVO.NewCabId); sqlCommand.Parameters.AddWithValue("@CabDate", objUserVO.CabDate); sqlDataAdapter.SelectCommand = sqlCommand; sqlDataAdapter.Fill(userdataset); } catch (Exception ex) { throw ex; } finally { sqlconnection.Close(); } return userdataset; } public DataSet getCabTime(UserVO objUserVO) { try { sqlconnection.Open(); userdataset.Tables.Clear(); sqlCommand.Connection = sqlconnection; sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.CommandText = "Cab_Usage_getCab_Time"; sqlCommand.Parameters.AddWithValue("@MSINewCabId", objUserVO.NewCabId); sqlCommand.Parameters.AddWithValue("@CabName", objUserVO.CabName); sqlDataAdapter.SelectCommand = sqlCommand; sqlDataAdapter.Fill(userdataset); } catch (Exception ex) { throw ex; } finally { sqlconnection.Close(); } return userdataset; }mishra.bhupe...
Participant
1596 Points
378 Posts
Re: Dropdown issue
Jun 25, 2012 09:37 AM|LINK
Can't find the problem, at least for second method call. Please tell us exactly which point you are getting this error. And please post your stored procedure's code if you can?