G
Guest
....I can't seem to get my hands on a control I'm loading in an editable
datagrid.
Here's my datagrid control:
<asp:datagrid
id="GLRulesGrid"
runat="server"
autogeneratecolumns="False"
oneditcommand="GLRulesGrid_Edit"
ondeletecommand="GLRulesGrid_Delete"
onupdatecommand="GLRulesGrid_Update"
oncancelcommand="GLRulesGrid_Cancel"
cssclass="embedded">
<headerstyle cssclass="large-title-red"></headerstyle>
<columns>
<asp:editcommandcolumn buttontype="LinkButton" edittext="Edit"
updatetext="Save" canceltext="Cancel" />
<asp:templatecolumn headertext="Transaction Type">
<itemtemplate>
<%# DataBinder.Eval(Container.DataItem, "TransactionType") %>
</itemtemplate>
<edititemtemplate>
<asp:dropdownlist
id="TransTypeList"
onload="TransTypeList_Load"
datasource="<%# TransTypes %>"
runat="server" />
</edititemtemplate>
</asp:templatecolumn>
<asp:templatecolumn headertext="Description">
<itemtemplate>
<%# DataBinder.Eval(Container.DataItem, "Description") %>
</itemtemplate>
<edititemtemplate>
<asp:textbox
id="DescBox"
runat="server"
text='<%# DataBinder.Eval(Container.DataItem, "Description") %>' />
</edititemtemplate>
</asp:templatecolumn>
</columns>
</asp:datagrid>
In the dropdown list in the first column...I'm simply loading this
collection in the code behind class:
protected IList TransTypes
{
get
{
IList tTypes = new ArrayList();
tTypes.Add("RECV");
tTypes.Add("ADJUST");
tTypes.Add("JENSEN");
tTypes.Add("VAP");
tTypes.Add("SAMPLE");
tTypes.Add("SENT");
return tTypes;
}
}
....which works just fine...but I want to be able to select the current value
in the datagrid cell in the DropDownList control so the user doesn't
accidentally update the record w/ the wrong value, which would be the default
selected item in the DDL.
You'll see that I tried to use the Load event for the DDL but I'm still
unable to use the FindControl method in the code behind to get ahold of the
dropdownlist.
How can I achieve this?
Thanks!
datagrid.
Here's my datagrid control:
<asp:datagrid
id="GLRulesGrid"
runat="server"
autogeneratecolumns="False"
oneditcommand="GLRulesGrid_Edit"
ondeletecommand="GLRulesGrid_Delete"
onupdatecommand="GLRulesGrid_Update"
oncancelcommand="GLRulesGrid_Cancel"
cssclass="embedded">
<headerstyle cssclass="large-title-red"></headerstyle>
<columns>
<asp:editcommandcolumn buttontype="LinkButton" edittext="Edit"
updatetext="Save" canceltext="Cancel" />
<asp:templatecolumn headertext="Transaction Type">
<itemtemplate>
<%# DataBinder.Eval(Container.DataItem, "TransactionType") %>
</itemtemplate>
<edititemtemplate>
<asp:dropdownlist
id="TransTypeList"
onload="TransTypeList_Load"
datasource="<%# TransTypes %>"
runat="server" />
</edititemtemplate>
</asp:templatecolumn>
<asp:templatecolumn headertext="Description">
<itemtemplate>
<%# DataBinder.Eval(Container.DataItem, "Description") %>
</itemtemplate>
<edititemtemplate>
<asp:textbox
id="DescBox"
runat="server"
text='<%# DataBinder.Eval(Container.DataItem, "Description") %>' />
</edititemtemplate>
</asp:templatecolumn>
</columns>
</asp:datagrid>
In the dropdown list in the first column...I'm simply loading this
collection in the code behind class:
protected IList TransTypes
{
get
{
IList tTypes = new ArrayList();
tTypes.Add("RECV");
tTypes.Add("ADJUST");
tTypes.Add("JENSEN");
tTypes.Add("VAP");
tTypes.Add("SAMPLE");
tTypes.Add("SENT");
return tTypes;
}
}
....which works just fine...but I want to be able to select the current value
in the datagrid cell in the DropDownList control so the user doesn't
accidentally update the record w/ the wrong value, which would be the default
selected item in the DDL.
You'll see that I tried to use the Load event for the DDL but I'm still
unable to use the FindControl method in the code behind to get ahold of the
dropdownlist.
How can I achieve this?
Thanks!