Hello everyone,
I am a complete newbie with ASP and VB.net so please forgive me when I ask something stupid! Sorry this is also a bit long!
I have a detailsview with a nested dropdown list. Here is the markup:
<aspetailsView ID="dvOperator" runat="server" Height="50px" Width="307px"
DataKeyNames="opid" AutoGenerateRows="False" BackColor="#CCCCCC"
BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px" CellPadding="4"
CellSpacing="2" ForeColor="Black">
<FooterStyle BackColor="#CCCCCC" />
<RowStyle BackColor="White" />
<PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" />
<Fields>
<asp:BoundField DataField="opid" HeaderText="Operator ID" />
<asp:BoundField DataField="clerkid" HeaderText="Clerk ID" />
<asp:BoundField DataField="opidmenu" HeaderText="Link to Menu" />
<asp:TemplateField HeaderText="Title">
<ItemTemplate>
<aspropDownList ID="ddTitle" runat="server" AutoPostBack="True"
DataTextField="Title" DataValueField="otitle" AppendDataBoundItems="True"
onselectedindexchanged="ddTitle_SelectedIndexChanged"
DataSourceID="m_decodeTitle">
</aspropDownList>
</ItemTemplate>
</asp:TemplateField>
</Fields>
<HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
</aspetailsView>
I have added the DataSourceID as “m_decodeTitle”. In my VB program (code behind?) I have the following code:
Imports Progress.Open4GL.Proxy
Imports Rapid
Partial Public Class _Default
Inherits System.Web.UI.Page
Private m_Connection As Connection
Private m_AppObject As RapidApp
Private m_SubAppObject As RapidSubApp
Dim m_OEConnect As New OEConnection
Dim m_opid As String = ""
Dim m_GCTitle As String = "opidtitle"
'Step 1 - Define a DataTable Member Variables
Private m_operators As Rapid.StrongTypesNS.dsSoperatorDataSet
Private m_details As Rapid.StrongTypesNS.dsSoperatorDataSet
Private m_decodeTitle As Rapid.StrongTypesNS.dsSdecodeDataSet
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
m_Connection = m_OEConnect.Connect
m_AppObject = New RapidApp(m_Connection)
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Connect Error")
End Try
If Not (m_AppObject Is Nothing) Then
m_SubAppObject = m_AppObject.CreateAO_RapidSubApp()
m_operators = New Rapid.StrongTypesNS.dsSoperatorDataSet
m_details = New Rapid.StrongTypesNS.dsSoperatorDataSet
m_decodeTitle = New Rapid.StrongTypesNS.dsSdecodeDataSet
m_SubAppObject.getoperator(m_opid, m_operators)
m_SubAppObject.getoperator(m_opid, m_details)
m_SubAppObject.getdecode(m_GCTitle, m_decodeTitle)
dgOperators.DataSource = m_operators
dgOperators.DataBind()
dvOperator.DataSource = m_details
dvOperator.DataBind()
End If
End Sub
All seems syntactically correct but when I run the program I get the following runtime error:
System.Web.HttpException was unhandled by user code ErrorCode=-2147467259
Message="The DataSourceID of 'ddTitle' must be the ID of a control of type IDataSource.
A control with ID 'm_decodeTitle' could not be found."
This error occurs at the line “dvOperator.DataBind()”.
Any ideas anyone? All help most gratefully received.
Thanks, Dave.
I am a complete newbie with ASP and VB.net so please forgive me when I ask something stupid! Sorry this is also a bit long!
I have a detailsview with a nested dropdown list. Here is the markup:
<aspetailsView ID="dvOperator" runat="server" Height="50px" Width="307px"
DataKeyNames="opid" AutoGenerateRows="False" BackColor="#CCCCCC"
BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px" CellPadding="4"
CellSpacing="2" ForeColor="Black">
<FooterStyle BackColor="#CCCCCC" />
<RowStyle BackColor="White" />
<PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" />
<Fields>
<asp:BoundField DataField="opid" HeaderText="Operator ID" />
<asp:BoundField DataField="clerkid" HeaderText="Clerk ID" />
<asp:BoundField DataField="opidmenu" HeaderText="Link to Menu" />
<asp:TemplateField HeaderText="Title">
<ItemTemplate>
<aspropDownList ID="ddTitle" runat="server" AutoPostBack="True"
DataTextField="Title" DataValueField="otitle" AppendDataBoundItems="True"
onselectedindexchanged="ddTitle_SelectedIndexChanged"
DataSourceID="m_decodeTitle">
</aspropDownList>
</ItemTemplate>
</asp:TemplateField>
</Fields>
<HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
</aspetailsView>
I have added the DataSourceID as “m_decodeTitle”. In my VB program (code behind?) I have the following code:
Imports Progress.Open4GL.Proxy
Imports Rapid
Partial Public Class _Default
Inherits System.Web.UI.Page
Private m_Connection As Connection
Private m_AppObject As RapidApp
Private m_SubAppObject As RapidSubApp
Dim m_OEConnect As New OEConnection
Dim m_opid As String = ""
Dim m_GCTitle As String = "opidtitle"
'Step 1 - Define a DataTable Member Variables
Private m_operators As Rapid.StrongTypesNS.dsSoperatorDataSet
Private m_details As Rapid.StrongTypesNS.dsSoperatorDataSet
Private m_decodeTitle As Rapid.StrongTypesNS.dsSdecodeDataSet
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
m_Connection = m_OEConnect.Connect
m_AppObject = New RapidApp(m_Connection)
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Connect Error")
End Try
If Not (m_AppObject Is Nothing) Then
m_SubAppObject = m_AppObject.CreateAO_RapidSubApp()
m_operators = New Rapid.StrongTypesNS.dsSoperatorDataSet
m_details = New Rapid.StrongTypesNS.dsSoperatorDataSet
m_decodeTitle = New Rapid.StrongTypesNS.dsSdecodeDataSet
m_SubAppObject.getoperator(m_opid, m_operators)
m_SubAppObject.getoperator(m_opid, m_details)
m_SubAppObject.getdecode(m_GCTitle, m_decodeTitle)
dgOperators.DataSource = m_operators
dgOperators.DataBind()
dvOperator.DataSource = m_details
dvOperator.DataBind()
End If
End Sub
All seems syntactically correct but when I run the program I get the following runtime error:
System.Web.HttpException was unhandled by user code ErrorCode=-2147467259
Message="The DataSourceID of 'ddTitle' must be the ID of a control of type IDataSource.
A control with ID 'm_decodeTitle' could not be found."
This error occurs at the line “dvOperator.DataBind()”.
Any ideas anyone? All help most gratefully received.
Thanks, Dave.