Ask a Question related to ASP.NET Data Grid Control, Design and Development.
-
jhcorey@yahoo.com #1
Stumped on dropdownlist, editcommand
I've been googling this and know it's been covered often, but I can't
get mine to work.
I'm using a dropdown list when editing the record in the datagrid.
I'm using an arraylist (although I'm willing to change) to populate the
dropdown.
The problem is selecting the item in the dropdown that corresponds to
the current record's value.
I have the code below. I'm looking for the simplest way to select the
correct value in the dropdownlist. I notice in the OnItemDataBound I
have to cast the item cells to textboxes when the item is being edited,
but I'm not sure how to find the value I need.
private void dg_Columns_Edit(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
dg_Columns.EditItemIndex = e.Item.ItemIndex;
rptDataTypes = new ArrayList();
rptDataTypes.Add("DESC");
rptDataTypes.Add("ASC");
FillColumnGrid();
DropDownList dl =
((DropDownList)dg_Columns.Items[e.Item.ItemIndex].Cells[5].FindControl("ddlSortDir"));
dl.DataSource = rptDataTypes;
dl.DataBind();
}
jhcorey@yahoo.com Guest
-
DataList's EditCommand not being raised
I am attempting to raise the EditCommand event of a DataList when a Button in the ItemTemplate is clicked. Here is the HTML used for the... -
error in getting textbox value in EditCommand
hi, i was trying to get the value of the textbox in the datagrid everytime the user click the edit button in the datagrid.. however i always... -
EditCommand event
Does anyone know how DataGrid knows which index of an Edit button/link caused the postback so as to pass it along as an argument to EditCommand... -
datagrid editcommand
Is it possible to use a drop combo instead of a text box when using the EditCommand in the Datagrid? Many table columns are bound to 'lookup'... -
EditCommand on Nested DataGrid
I can't figure out how to use the EditCommand for the nested datagrid .. HELP PLEASE ;-) It works perfectly for the parent datagrid, but will not... -
Patrick.O.Ige #2
Re: Stumped on dropdownlist, editcommand
There is a good sample here at:-
[url]http://www.4guysfromrolla.com/webtech/050801-1.shtml[/url]
Patrick
<jhcorey@yahoo.com> wrote in message
news:1131395278.366298.113620@g14g2000cwa.googlegr oups.com...((DropDownList)dg_Columns.Items[e.Item.ItemIndex].Cells[5].FindControl("ddlS> I've been googling this and know it's been covered often, but I can't
> get mine to work.
>
> I'm using a dropdown list when editing the record in the datagrid.
> I'm using an arraylist (although I'm willing to change) to populate the
> dropdown.
>
> The problem is selecting the item in the dropdown that corresponds to
> the current record's value.
>
> I have the code below. I'm looking for the simplest way to select the
> correct value in the dropdownlist. I notice in the OnItemDataBound I
> have to cast the item cells to textboxes when the item is being edited,
> but I'm not sure how to find the value I need.
>
>
> private void dg_Columns_Edit(object source,
> System.Web.UI.WebControls.DataGridCommandEventArgs e)
> {
> dg_Columns.EditItemIndex = e.Item.ItemIndex;
> rptDataTypes = new ArrayList();
> rptDataTypes.Add("DESC");
> rptDataTypes.Add("ASC");
>
> FillColumnGrid();
> DropDownList dl =
>
ortDir"));> dl.DataSource = rptDataTypes;
> dl.DataBind();
>
>
> }
>
Patrick.O.Ige Guest



Reply With Quote

