Event Not Firing for DropdownList in DataGrid

  • Thread starter Thread starter AdrEsqu
  • Start date Start date
A

AdrEsqu

I am trying to use AutoPostback to retrieve the value that was selected

in my dropdownlist. The event is not firing for the dropdownlist
because the datagrid is being built after the Lifecycle of the Firing
Events. So in order to capture my selected value I need to capture it
in the OnInit when the autopostback fires, but I don't know how I can
do this.

Since the Page Lifecycle fires events before my datagrid gets built
then I can not use the eventhandler for my dropdownlist if anybody has
any help I really could use it.


Thanks,


Adrian


Reply
 
I think you want to create a method that fires when the selected index
changes for the dropdownlist. Its hard to say much else using just the
information you provided.
 
Here is code for my dropdownlist

private RebarDropDownList ObjectNameList
{
get
{
EnsureChildControls();
if (nameListValue == null)
{
nameListValue = new RebarDropDownList();
nameListValue.RebarPageSet(this.PageCommon());
nameListValue.PartsToRender =
ControlPartsToRender.ControlOnly;
nameListValue.SelectedIndexChanged += new
EDS.Rebar.Web.WebControls.RebarDropDownList.SelectedIndexChangedEventHandler(DropDownListValue_SelectedIndexChanged);
nameListValue.AutoPostBack = true;
nameListValue.ID = "objectnameList";
FillObjectNameList();
}
return nameListValue;
}
}


Code for outputing the dropdownlist

private void MetaDataGrid_AddHeaderRows(
RebarGrid grid)
{

RebarGridCellHeader cellHeader;
grid.AddNewHeaderRow();

//Blank Cell
cellHeader = grid.AddNewHeaderCell();
cellHeader.Text = "Icon";


grid.AddNewHeaderRow();
for (Int32 r = 0; r < MetadataHeaders.Count; r++)
{
if (MetadataOptions[r].ToString() == "object_name")
{
RebarGridCell cellListHeader = grid.AddNewCellToHeader();
cellListHeader.Controls.Add(ObjectNameList);
}


THE "MetaDataGrid_AddHeaderRows" is in my CreateChildControls as
"this.Controls.Add(MetaDataGrid);"

Problem is the eventhandler does not fire because the DataGrid gets
built after the events lifecycle so I'm trying to get the selected
values without using the eventhandler.

Thanks.
 
Back
Top