Hi, I want to create a dropdownlist when an item is selected the user is redirected to another page and content about the item is displayed, all of this is done with stored procedures, but it does not seem to pass parameters to the stored procedure. I know the paramater is not passing but I don't know ehy not.
error:
Procedure or Function 'GetWidth' expects parameter '@WidthID', which was not supplied.
Can anyone help please?
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
string widthId =
Server.UrlEncode(form.SelectedValue.ToString());
Response.Redirect(Link.ToWidth(widthId));
}
private static string BuildAbsolute(string relativeUri)
{
Uri uri = HttpContext.Current.Request.Url;
string app = HttpContext.Current.Request.ApplicationPath;
if (!app.EndsWith("/")) app += "/";
relativeUri = relativeUri.TrimStart('/');
return HttpUtility.UrlPathEncode(
String.Format("http://{0}:{1}{2}{3}",
uri.Host, uri.Port, app, relativeUri));
}
public static string ToWidth(string widthId)
{
return BuildAbsolute(String.Format("WidthAdmin.aspx?Width={0}", widthId));
}
This is the receiving page, maybe I'm not calling it correctly, cause if I don't populate the GridView I get no errors
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
BindGrid();
}
}
private void BindGrid()
{
string widthId =
Server.UrlDecode(Request.QueryString["WidthID"]);
grid.DataSource = CatalogAccess.GetWidth(widthId);
grid.DataBind();
}