S
Stephanie
I have a page with 2 drop down list, each set to autopostback = true. I have
a gridview bound to an objectdatasource which is connected (what would be
the right term here?) to a tableadapter in a dataset.
I have an event for each drop down to add a blank entry to the drop down:
protected void ddMediumId_DataBound(object sender, EventArgs e)
{
ddMediumId.Items.Insert(0, ""); <-- little side question, how do I make
the value of this item zero?
}
protected void ddStatusList_DataBound(object sender, EventArgs e)
{
ddStatusList.Items.Insert(0, "");
}
On page load, I am trying to filter the objectdatasource data based on the
selection from the drop down lists. I am testing first with only one of the
drop downs.
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack)
{
string sMediumId;
string sStatusId;
sMediumId = ddMediumId.SelectedValue;
sStatusId = ddStatusList.SelectedValue;
/// do something to get the code to filter the ol crapola
lblTest.Text = "" + sMediumId + " - " + sStatusId;
if (!sMediumId.Equals(""))
{
dbviewArtworkList.FilterExpression = "meduimId='{" + sMediumId +"}'";
}
}
}
I got the syntax for the FilterExpression string from an example on the web.
I am not certain it is correct. So this code runs, executes properly when
the mediumId has been selected. But no filter on the data occurs. My guess
is one of the following:
- I need some kind of method for yes, please rebind me.
- I need to put it in a more appropriate event whose timing regarding the
creation of the objectdatasource would make this work... I tried the
onfiltering event, but that did not work either... Nothing causedthe
filtering to fire... That makes sense. I tried the onselecting event, that
fired on the first page load but not on postback. (That makes no sense to
me.,,)
Anyway, can anyone please give me a nudge as to what I am missing. I am sure
this is really straightforward and I am having brain freeze. Thanks!
a gridview bound to an objectdatasource which is connected (what would be
the right term here?) to a tableadapter in a dataset.
I have an event for each drop down to add a blank entry to the drop down:
protected void ddMediumId_DataBound(object sender, EventArgs e)
{
ddMediumId.Items.Insert(0, ""); <-- little side question, how do I make
the value of this item zero?
}
protected void ddStatusList_DataBound(object sender, EventArgs e)
{
ddStatusList.Items.Insert(0, "");
}
On page load, I am trying to filter the objectdatasource data based on the
selection from the drop down lists. I am testing first with only one of the
drop downs.
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack)
{
string sMediumId;
string sStatusId;
sMediumId = ddMediumId.SelectedValue;
sStatusId = ddStatusList.SelectedValue;
/// do something to get the code to filter the ol crapola
lblTest.Text = "" + sMediumId + " - " + sStatusId;
if (!sMediumId.Equals(""))
{
dbviewArtworkList.FilterExpression = "meduimId='{" + sMediumId +"}'";
}
}
}
I got the syntax for the FilterExpression string from an example on the web.
I am not certain it is correct. So this code runs, executes properly when
the mediumId has been selected. But no filter on the data occurs. My guess
is one of the following:
- I need some kind of method for yes, please rebind me.
- I need to put it in a more appropriate event whose timing regarding the
creation of the objectdatasource would make this work... I tried the
onfiltering event, but that did not work either... Nothing causedthe
filtering to fire... That makes sense. I tried the onselecting event, that
fired on the first page load but not on postback. (That makes no sense to
me.,,)
Anyway, can anyone please give me a nudge as to what I am missing. I am sure
this is really straightforward and I am having brain freeze. Thanks!