jplanet
Posts: 2
|
Posted: 04/30/2004, 8:03 AM |
|
I have an editable grid, which needs to do the following:
Each row needs a button, when executed it executes a stored proc.
The proc needs the selected value of a dropdown as a parameter.
So, I created a button, added the following code to the onclick event:
System.Web.HttpContext context=System.Web.HttpContext.Current;
DataAccessObject NewDao=Settings.SunriseDataAccessObject;
string Sql = "exec RoomAllElevations '{ListBox1}'";
NewDao.RunSql(Sql);
The proc successfully executes, although it is accepting the string literal '{ListBox1}', and not the actual value of the current row's listbox value. Any idea what variable will return the variable of the currently selected item?
|
|
|
Stan
|
Posted: 05/04/2004, 12:57 AM |
|
Hi
Try the following trick
firstly obtain the rpeater item, which correspond to the pressed button
RepeaterItem item = e.Item;
then find the listbox in item collection
HtmlSelect ListBox1 = (HtmlSelect)(item.FindControl("<EditableGridName>ListBox1");
after this you can obtain the selected value from listbox
string Sql = "exec RoomAllElevations '"+ListBox1.Value+"'";
Stan
|
|
|
|