G
Guest
I have a datalist which has an edititem template.
When the user is in edit mode (of the datalist) it shows a couple of text
boxes for editing as well as a drop down list box and has a label control.
When the user changes the item in the drop down list I would like to set the
labels text property to a different description.
My problem is I have the event that can be triggered when the Drop down
selected index changes but can't seem to get a reference to the data list
label control for that particular item being edited.
Here is an example of something of I have:
Within the edit item template of the data grid exists something like this :
<TR>
<TD>
<asp:label id="Label11" runat="server" Font-Underline="True" Width="104px"
Height="15px" Font-Size="X-Small">Chosen Title:</asp:label><BR>
<asp:dropdownlist id=ddlChosenTitle runat="server" Width="228px"
Height="25px" OnSelectedIndexChanged="dl_SelectedIndexChanged"
AutoPostBack="True" DataValueField="Title_ID" DataTextfield="Title"
Datasource="<%# GetTitles() %>"></asp:dropdownlist>
</TD>
<TD>
<asp:label id="lblProfDescr" runat="server" Font-Size="X-Small"></asp:label>
</TD>
</TR>
In the vb code behind is this event which fires when the ddl is changed:
I am having trouble using the find control method or other way to get a
reference the the lblProfDescr so I can set the text property
Public Sub dl_SelectedIndexChanged(ByVal Sender As Object, ByVal e As
System.EventArgs)
Dim lblDescr As Label
Try
Dim dl As DropDownList = CType(Sender, DropDownList) ' this
would get a reference to the DDL
'This is where I would like to get the reference to the specific label and
set/change its text property
Catch eMsg As Exception
'send message
End Try
End Sub
When the user is in edit mode (of the datalist) it shows a couple of text
boxes for editing as well as a drop down list box and has a label control.
When the user changes the item in the drop down list I would like to set the
labels text property to a different description.
My problem is I have the event that can be triggered when the Drop down
selected index changes but can't seem to get a reference to the data list
label control for that particular item being edited.
Here is an example of something of I have:
Within the edit item template of the data grid exists something like this :
<TR>
<TD>
<asp:label id="Label11" runat="server" Font-Underline="True" Width="104px"
Height="15px" Font-Size="X-Small">Chosen Title:</asp:label><BR>
<asp:dropdownlist id=ddlChosenTitle runat="server" Width="228px"
Height="25px" OnSelectedIndexChanged="dl_SelectedIndexChanged"
AutoPostBack="True" DataValueField="Title_ID" DataTextfield="Title"
Datasource="<%# GetTitles() %>"></asp:dropdownlist>
</TD>
<TD>
<asp:label id="lblProfDescr" runat="server" Font-Size="X-Small"></asp:label>
</TD>
</TR>
In the vb code behind is this event which fires when the ddl is changed:
I am having trouble using the find control method or other way to get a
reference the the lblProfDescr so I can set the text property
Public Sub dl_SelectedIndexChanged(ByVal Sender As Object, ByVal e As
System.EventArgs)
Dim lblDescr As Label
Try
Dim dl As DropDownList = CType(Sender, DropDownList) ' this
would get a reference to the DDL
'This is where I would like to get the reference to the specific label and
set/change its text property
Catch eMsg As Exception
'send message
End Try
End Sub