FormView
我在其EditTemplate中放了2个DropDownList也就是希望在编辑状态下操作时,对于下拉框1中的值改变时,Postback刷新一下下拉框2中的可选项值,也就是联动但总是提示如下错误:=========================================================
用户代码未处理 System.InvalidOperationException
Message="Eval()、XPath() 和 Bind() 这类数据绑定方法只能在数据绑定控件的上下文中使用。"
Source="System.Web"
StackTrace:
在 System.Web.UI.Page.GetDataItem()
在 System.Web.UI.TemplateControl.Eval(String expression)
在 ASP.order_ordermain_aspx.__DataBinding__control53(Object sender, EventArgs e) 位置 d:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\OCRS_NET\Order\OrderMain.aspx:行号 167
在 System.Web.UI.Control.OnDataBinding(EventArgs e)
在 System.Web.UI.WebControls.ListControl.OnDataBinding(EventArgs e)
在 System.Web.UI.WebControls.ListControl.PerformSelect()
在 System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
在 System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound()
在 System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e)
在 System.Web.UI.WebControls.ListControl.OnPreRender(EventArgs e)
在 System.Web.UI.Control.PreRenderRecursiveInternal()
在 System.Web.UI.Control.PreRenderRecursiveInternal()
在 System.Web.UI.Control.PreRenderRecursiveInternal()
在 System.Web.UI.Control.PreRenderRecursiveInternal()
在 System.Web.UI.Control.PreRenderRecursiveInternal()
在 System.Web.UI.Control.PreRenderRecursiveInternal()
在 System.Web.UI.Control.PreRenderRecursiveInternal()
在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
我在其EditTemplate中放了2个DropDownList也就是希望在编辑状态下操作时,对于下拉框1中的值改变时,Postback刷新一下下拉框2中的可选项值,也就是联动但总是提示如下错误:=========================================================
用户代码未处理 System.InvalidOperationException
Message="Eval()、XPath() 和 Bind() 这类数据绑定方法只能在数据绑定控件的上下文中使用。"
Source="System.Web"
StackTrace:
在 System.Web.UI.Page.GetDataItem()
在 System.Web.UI.TemplateControl.Eval(String expression)
在 ASP.order_ordermain_aspx.__DataBinding__control53(Object sender, EventArgs e) 位置 d:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\OCRS_NET\Order\OrderMain.aspx:行号 167
在 System.Web.UI.Control.OnDataBinding(EventArgs e)
在 System.Web.UI.WebControls.ListControl.OnDataBinding(EventArgs e)
在 System.Web.UI.WebControls.ListControl.PerformSelect()
在 System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
在 System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound()
在 System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e)
在 System.Web.UI.WebControls.ListControl.OnPreRender(EventArgs e)
在 System.Web.UI.Control.PreRenderRecursiveInternal()
在 System.Web.UI.Control.PreRenderRecursiveInternal()
在 System.Web.UI.Control.PreRenderRecursiveInternal()
在 System.Web.UI.Control.PreRenderRecursiveInternal()
在 System.Web.UI.Control.PreRenderRecursiveInternal()
在 System.Web.UI.Control.PreRenderRecursiveInternal()
在 System.Web.UI.Control.PreRenderRecursiveInternal()
在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
解决方案 »
- 给一个option标签写一个不存在的关键字时?
- asp.net 如何缓存问题
- 求一正则表达式
- asp.net 程序在IIS中运行 错误
- 如何在服务器端获取javascript动态在table中加的值
- 有人可以为我解释解释一下,这个语句吗,谢谢啦
- 如何动态 向 Web 窗体页中的table单元格中添加 RadioButtonList Web 服务器控件,类似于考试系统的选项按钮
- 关于做一个选择题的功能
- 对多个表选定得字段进行查询,使显示时候变为中文怎么改写?
- TextBox如何即时(焦点不用跳出TextBox)响应OnTextChanged事件?帮帮忙,否则今天白过了!!
- [高分求解]初学asp.net,简单问题求详细解答!
- 怎么不能编辑,求大家帮帮我
<p align="justify">
<table>
<tr>
<td align="right" style="height: 26px">
<asp:Label ID="Label9" runat="server" Text="订单编号:"></asp:Label></td>
<td align="left" style="height: 26px">
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("sOrder_no") %>' Width="185px" ReadOnly="True"></asp:TextBox></td>
<td align="right" style="height: 26px">
<asp:Label ID="Label10" runat="server" Text="购买总数量:"></asp:Label></td>
<td align="left" style="height: 26px; width: 158px;">
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("fTotalCount") %>' Width="100px" ReadOnly="True"></asp:TextBox></td>
</tr>
<tr>
<td align="right" style="height: 26px">
<asp:Label ID="Label2" runat="server" Text="销售单位:"></asp:Label></td>
<td align="left" style="height: 26px">
<asp:TextBox ID="TextBox6" runat="server" Text='<%# Bind("sCompany_no") %>' Width="185px" ReadOnly="True"></asp:TextBox></td>
<td align="right" style="height: 26px">
<asp:Label ID="Label5" runat="server" Text="单据方式:" Width="97px"></asp:Label></td>
<td align="left" style="height: 26px; width: 158px;">
<asp:DropDownList ID="ddlBillCL" runat="server" Width="104px" DataSourceID="ObjectDataSource_BillClass" DataTextField="sBillCLName" DataValueField="sBillCLNo">
</asp:DropDownList></td>
</tr>
<tr>
<td align="right" style="height: 26px">
<asp:Label ID="Label1" runat="server" Text="客商名称:" Width="97px"></asp:Label></td>
<td align="left" style="height: 26px">
<asp:TextBox ID="TextBox7" runat="server" Text='<%# Bind("sCustb_name") %>' Width="186px" ReadOnly="True"></asp:TextBox></td>
<td align="right" style="height: 26px">
<asp:Label ID="Label13" runat="server" Text="结算类型:" Width="97px"></asp:Label></td>
<td align="left" style="height: 26px; width: 158px;">
<asp:DropDownList ID="ddlJSType" runat="server" Width="104px">
<asp:ListItem Value="1">按吨数</asp:ListItem>
<asp:ListItem Value="0">按金额</asp:ListItem>
</asp:DropDownList></td>
</tr>
<tr>
<td align="right" style="height: 24px">
<asp:Label ID="Label3" runat="server" Text="场地名称:"></asp:Label></td>
<td align="left" style="height: 24px">
<asp:DropDownList ID="ddlMeiChang" runat="server" Width="190px" DataSourceID="ObjectDataSource_MeiChang" DataTextField="sMC_name" DataValueField="sMeiChang_no" AutoPostBack="True" SelectedValue='<%# Bind("sMeiChang_no") %>'>
</asp:DropDownList></td>
<td align="right" style="height: 24px">
<asp:Label ID="Label4" runat="server" Text="磅房名称:" Width="97px"></asp:Label></td>
<td align="left" style="height: 24px; width: 158px;">
<asp:DropDownList ID="ddlBangfang" runat="server" Width="105px" DataSourceID="ObjectDataSource_BangFang" DataTextField="sBF_name" DataValueField="sBangFang_no">
</asp:DropDownList>
<asp:TextBox ID="tbBangFang" runat="server" Text='<%# Bind("sBangFang_no") %>' Visible="False"></asp:TextBox></td>
</tr>
<tr>
<td align="right" style="height: 24px">
<asp:Label ID="Label6" runat="server" Text="工作流:" Width="78px"></asp:Label></td>
<td align="left" style="height: 24px">
<asp:DropDownList ID="ddlWorkFlow1" runat="server" Width="188px" DataSourceID="ObjectDataSource_WorkFlow" DataTextField="sWorkFlow_name" DataValueField="sWorkFlow_no" SelectedValue='<%# Bind("sWorkFlow_name") %>'>
</asp:DropDownList></td>
<td align="right" style="height: 24px">
<asp:Label ID="Label7" runat="server" Text="转零售工作流:" Width="160px"></asp:Label></td>
<td align="left" style="height: 24px; width: 158px;">
<asp:DropDownList ID="ddlWorkFlow2" runat="server" Width="104px" DataSourceID="ObjectDataSource_WorkFlow" DataTextField="sWorkFlow_name" DataValueField="sWorkFlow_no" SelectedValue='<%# Bind("sWorkFlow_name2") %>'>
</asp:DropDownList></td>
</tr>
<tr>
<td align="right" style="height: 26px">
<asp:Label ID="Label11" runat="server" Text="建单时间:" Width="97px"></asp:Label></td>
<td align="left" style="height: 26px">
<asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("dCreateTime") %>' Width="180px" ReadOnly="True"></asp:TextBox></td>
<td align="right" style="height: 26px">
<asp:Label ID="Label8" runat="server" Text="状态:" Width="97px"></asp:Label></td>
<td align="left" style="height: 26px; width: 158px;">
<asp:TextBox ID="TextBox4" runat="server" Width="100px" ReadOnly="True" Text='<%# Bind("sBillStatus") %>'></asp:TextBox></td>
</tr>
</table>
</p>
<asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
Text="更新"></asp:LinkButton>
<asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
Text="取消"></asp:LinkButton>
</EditItemTemplate>
===========================================================
<tr>
<td align="right" style="height: 24px">
<asp:Label ID="Label3" runat="server" Text="场地名称:"></asp:Label></td>
<td align="left" style="height: 24px">
<asp:DropDownList ID="ddlMeiChang" runat="server" Width="190px" DataSourceID="ObjectDataSource_MeiChang" DataTextField="sMC_name" DataValueField="sMeiChang_no" AutoPostBack="True" SelectedValue='<%# Bind("sMeiChang_no") %>'>
</asp:DropDownList></td>
<td align="right" style="height: 24px">
<asp:Label ID="Label4" runat="server" Text="磅房名称:" Width="97px"></asp:Label></td>
<td align="left" style="height: 24px; width: 158px;">
<asp:DropDownList ID="ddlBangfang" runat="server" Width="105px" DataSourceID="ObjectDataSource_BangFang" DataTextField="sBF_name" DataValueField="sBangFang_no">
</asp:DropDownList>
<asp:TextBox ID="tbBangFang" runat="server" Text='<%# Bind("sBangFang_no") %>' Visible="False"></asp:TextBox></td>
</tr>
<td align="right" style="height: 24px">
<asp:Label ID="Label3" runat="server" Text="场地名称:"></asp:Label></td>
<td align="left" style="height: 24px">
<asp:DropDownList ID="ddlMeiChang" runat="server" Width="190px" DataSourceID="ObjectDataSource_MeiChang" DataTextField="sMC_name" DataValueField="sMeiChang_no" AutoPostBack="True" SelectedValue='<%# Bind("sMeiChang_no") %>'>
</asp:DropDownList></td>
<td align="right" style="height: 24px">
<asp:Label ID="Label4" runat="server" Text="磅房名称:" Width="97px"></asp:Label></td>
<td align="left" style="height: 24px; width: 158px;">
<asp:DropDownList ID="ddlBangfang" runat="server" Width="105px" DataSourceID="ObjectDataSource_BangFang" DataTextField="sBF_name" DataValueField="sBangFang_no" SelectedValue='<%# Bind("sBangFang_no") %>'>
</asp:DropDownList>
</td>
</tr>
不过我还是看得不太明白,你的控制联动的代码呢?难道vs2005里面不需要写后台代码?
第一个dropdownlist 的
SelectedValue='<%# Bind("sMeiChang_no") %>' 一旦更改,就能自动触发DataSourceID="ObjectDataSource_BangFang" 也发生更改吗?