为什么呢?新手求助
我打开一个aspx页面源文件(源码附后面),想在浏览器里运行看看,但是报告错误:
C:\guest\Leave.aspx(1,29):error CS0029:无法将类型"string"隐式转换为"System.Web.UI.WebControls.TextBox"
我在网上查了大半天了,但是网上情况跟我的好像不一样.网上说是因为TextBox.text没赋值。但我没有赋值给TextBox啊,我是只是把TextBox的内容body,Title绑定了而已。
再补充一点情况,供参考。我看这个错误提示是指向1行,29列,但是那个位置是"MasterPageFile....."这句话 ,我想应该不是它的问题。后来我反正也没办法,干脆把MasterPageFile="~/Common/MasterPage.master" 这句也删了,但是错误一样:
C:\guest\Leave.aspx(1,29):error CS0029:无法将类型"string"隐式转换为"System.Web.UI.WebControls.TextBox"。
还是在1行,29列。然后我就倒了。。
下面是源码,有些我注释掉了:
<%@ Page Language="C#" MasterPageFile="~/Common/MasterPage.master" AutoEventWireup="true" CodeFile="LeaveBoard.aspx.cs" Inherits="Guest_LeaveBoard" Title="Untitled Page" %>
<%@ Register Src="../Common/TreeMovie.ascx" TagName="TreeMovie" TagPrefix="uc1" %>
<%@ Register TagPrefix="webdiyer" Namespace="Wuqi.Webdiyer" Assembly="AspNetPager" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div>
<table style="width: 100%;">
<tr>
<td colspan=3 style="height: 20px">
<span style="font-size: 14pt;"><asp:Label ID="Label3" runat="server" Width="400px">留言</asp:Label></span>
</tr>
<tr>
<td style="width:15px">
</td>
<td style="width: 130px" class="h2">
<uc1:TreeMovie ID="TreeMovie1" runat="server" />
</td>
<td style="width:520px;">
<asp:Panel ID="Panel1" runat="server" Height="400px" Width="520px" ScrollBars="Vertical">
<form id="form1" runat="server">
<table style="width:520px;table-layout:fixed" align="center">
<tr>
<td><font size="4">用户留言:</font></td><td align="right">
</tr>
<tr>
<td colspan="2">
<asp:GridView ID="LeaveBoardList" DataSourceID="srcLeaveBoard" CellPadding="4" CssClass="GbText" runat="server" AutoGenerateColumns="False" ShowHeader="False" Width="100%" ForeColor="#333333" GridLines="None" >
<Columns>
<asp:TemplateField>
<ItemTemplate>
<tr>
<td height="30" style="font-weight: bold; border-bottom: Wheat thin solid;">主题:<%# DataBinder.Eval(Container.DataItem,"Title") %></td>
</tr>
<tr>
<td><br /> <%# FormatBody((String)DataBinder.Eval(Container.DataItem,"Body")) %></td>
</tr>
<%--
<tr>
<td align="left" style="width:100%"><br />
<asp:Panel ID="ReplyPanel" Visible='<%# IsShowReply %>' runat="server" Width="100%"><asp:Label ID="White" runat="server" Width="50">
</asp:Label><font color="#FFD700">留言回复:<br /></font><asp:Label ID="Label1" runat="server" Width="50"></asp:Label><font color="green" ><%# DataBinder.Eval(Container.DataItem,"ReplyBody") %></font></asp:Panel><br />
</td>
</tr>
--%>
<tr>
<td align="right" style="width: 100%; position: static;">
<font class=gbtext color=gold>留言时间:<%# DataBinder.Eval(Container.DataItem,"CreateTime") %>
</font>
</td>
</tr>
<%-- </table> --%>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="White" />
<EditRowStyle BackColor="#7C6F57" />
<SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#66666" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
</td>
</tr>
</table>
<table width="100%" align="center" style="background-color: #E3EAEB;" >
<tr>
<td width="100%"><font color=#FFD700>IP地址:(<%=IPAddress%>)</font></td>
</tr>
<tr>
<td style="height: 48px"><font color=#FFD700>留言主题:</font>
<br>
<asp:Textbox id="Title" Runat="server" CssClass="InputCss" Width="300px"></asp:textbox>
<font class="GbText" color="red">*</font><asp:RequiredFieldValidator id="rfTitle" runat="server" ErrorMessage="(主题不能为空!!!)" ControlToValidate="Title"
CssClass="GbText"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td><font class="Normal" color=#FFD700>留言内容(内容的长度大于10!):</font>
<br>
<asp:TextBox ID="Body" CssClass="InputCss" Runat="server" TextMode="MultiLine" Width="400px" Height="200px"></asp:TextBox>
</td>
</tr>
</table>
<table width="100%" align="center" style="background-color: #E3EAEB;">
<tr>
<td align="center" width="400"><br>
<asp:Button ID="SureBtn" Runat="server" CssClass="ButtonCss" Text="我要留言" Width="200px" OnClick="SureBtn_Click"></asp:Button>
<br>
</td>
</tr>
</table>
</form>
</asp:Panel>
</td>
</tr>
</table>
</div>
</asp:Content>
请问各位有没遇到过这种情况,该怎么解决呢?有什么思路也可以说出来,谢谢。
这么晚了都,大家都睡了吧。。。Good night.今天晚点再来看看。
相关推荐
求助基于旋转坐标下的PMSM滑模观测器为什么不对呢-dqsuoxianghuanhuamoguanceqi.slx
求助基于旋转坐标下的PMSM滑模观测器为什么不对呢-dqsuoxianghuanhuamoguanceqi.slx 求助:基于旋转坐标下的PMSM滑模观测器,为什么不对呢?
新手求助RBF神经网络数据预测问题-数据.xls
新手求助RBF神经网络数据预测问题-数据.xls 本程序用前六个数据预测下一数据,前200组数据用于训练,用后80组数据进行预测,可预测结果为一个值,请大家指教: 源程序为: clc clear close all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %每五个数据整合, x=xlsread; n=length m=5; sum=0; j=1; x1=zeros); for k=1:m:n for i=k: sum=sum x; end x1=sum; j=j 1; sum=0; end j t=1:; figure plot;%,'d-m' hold on; grid on title; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %归一化处理 [x2,mint,maxt] = premnmx figure plot;%,'d-m' hold on; grid on title; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %输入数据 for k=1:1:200 p_train=[x2 x2 x2 x2 x2 x2]; 5*6 t_train=x2; 5*1 end p_train=p_train'; %6*195 t_train=t_train'; %1*195 for z=1:1:81 p_test=[x2 x2 x2 x2 x2 x2]; t_test=x2; end p_test=p_test'; t_test=t_test'; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %建立 RBF 网络 goal = 0.0001; % 训练误差的平方和 spread = 0.01; % 此值越大,需要的神经元就越少 MN = size; % 最大神经元数 DF = 1; % 显示间隔 net = newrb; data_out=sim p_mse=mse figure plot hold on plot title; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %预测并作图 y=sim y_mse=mse figure plot; hold on; plot title; legend;
新手求助第二次输入数据怎么让switch函数重新确定-geshui.fig
新手求助第二次输入数据怎么让switch函数重新确定-geshui.fig 各位大神,我是新手,自学matlab,编写了一个计算个税缴纳的计算器GUI,来熟悉matlab的函数。 思路是输入应发工资、公积金抵税额、五险一金,输出交税额、实发工资。 其中,应发工资、公积金抵税额是edit直接输入,五险一金提供了两种方法,第一种是直接输入总额,第二种是输入缴费基数、缴费比例,计算得到。 这两种方式通过radio button二选一来选择,分别为选项一、选项二。设置一个计算button,现在遇到的问题有两个,如下: 1、运行GUI后,输入应发工资、公积金抵税额,五险一金总额,radio默认是五险一金总额计算方法,点击计算button,不能输出结果到edit。须点选项二radio button,再点击选项一radio button,计算才能输出结果。 2、第一次计算后,修改五险一金总额edit数值,点击计算button,输出结果不改变。但是修改公积金抵税额edit数值,点击计算button,可以正常计算。 请教大神,这两个问题如何解决?
新手求助RBF神经网络数据预测问题-历史开奖数据.xlsx
新手求助RBF神经网络数据预测问题-历史开奖数据.xlsx 本程序用前六个数据预测下一数据,前200组数据用于训练,用后80组数据进行预测,可预测结果为一个值,请大家指教: 源程序为: clc clear close all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %每五个数据整合, x=xlsread; n=length m=5; sum=0; j=1; x1=zeros); for k=1:m:n for i=k: sum=sum x; end x1=sum; j=j 1; sum=0; end j t=1:; figure plot;%,'d-m' hold on; grid on title; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %归一化处理 [x2,mint,maxt] = premnmx figure plot;%,'d-m' hold on; grid on title; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %输入数据 for k=1:1:200 p_train=[x2 x2 x2 x2 x2 x2]; 5*6 t_train=x2; 5*1 end p_train=p_train'; %6*195 t_train=t_train'; %1*195 for z=1:1:81 p_test=[x2 x2 x2 x2 x2 x2]; t_test=x2; end p_test=p_test'; t_test=t_test'; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %建立 RBF 网络 goal = 0.0001; % 训练误差的平方和 spread = 0.01; % 此值越大,需要的神经元就越少 MN = size; % 最大神经元数 DF = 1; % 显示间隔 net = newrb; data_out=sim p_mse=mse figure plot hold on plot title; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %预测并作图 y=sim y_mse=mse figure plot; hold on; plot title; legend;
新手求助第二次输入数据怎么让switch函数重新确定-geshui.m
新手求助第二次输入数据怎么让switch函数重新确定-geshui.m 各位大神,我是新手,自学matlab,编写了一个计算个税缴纳的计算器GUI,来熟悉matlab的函数。 思路是输入应发工资、公积金抵税额、五险一金,输出交税额、实发工资。 其中,应发工资、公积金抵税额是edit直接输入,五险一金提供了两种方法,第一种是直接输入总额,第二种是输入缴费基数、缴费比例,计算得到。 这两种方式通过radio button二选一来选择,分别为选项一、选项二。设置一个计算button,现在遇到的问题有两个,如下: 1、运行GUI后,输入应发工资、公积金抵税额,五险一金总额,radio默认是五险一金总额计算方法,点击计算button,不能输出结果到edit。须点选项二radio button,再点击选项一radio button,计算才能输出结果。 2、第一次计算后,修改五险一金总额edit数值,点击计算button,输出结果不改变。但是修改公积金抵税额edit数值,点击计算button,可以正常计算。 请教大神,这两个问题如何解决?


