编译器错误信息: CS0029: 无法将类型“string”隐式转换为“System.Web.UI.WebControls.DropDownList”源错误:
行 1: <%@ Page Language="C#" MasterPageFile="~/index.master" AutoEventWireup="true" CodeFile="CorpPerson.aspx.cs" Inherits="SP_HRM_OrgStru_CorpPerson" Title="Untitled Page" %>
行 2: <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
行 3:
源文件: z:\Smartpod\SP_HRM\OrgStru\CorpPerson.aspx 行: 1 这种错误做何解释?string类型和控件之间有什么转换?代码中的DropDownList如下:
<asp:DropDownList ID="HasChild" runat="server" Width="30%">
<asp:ListItem Value="0">无</asp:ListItem>
<asp:ListItem Value="1">有</asp:ListItem>
</asp:DropDownList>
这一种是控件中添加项得到的。<asp:DropDownList ID="CropKind" runat="server" DataSourceID="SqlDataSource1" DataTextField="Class_ChnName" DataValueField="Class_ChnName">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:SmartpodConnectionString %>"
SelectCommand="SELECT [Class_ChnName] FROM [B_Colligate] WHERE ([Class_Mark] = @Class_Mark)">
<SelectParameters>
<asp:Parameter DefaultValue="企业性质" Name="Class_Mark" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
这一种是和数据源绑定得到的。并且数据源测试连接通过。两种方式均在设计页面通过控件操作完成!出现如此问题实在郁闷!
行 1: <%@ Page Language="C#" MasterPageFile="~/index.master" AutoEventWireup="true" CodeFile="CorpPerson.aspx.cs" Inherits="SP_HRM_OrgStru_CorpPerson" Title="Untitled Page" %>
行 2: <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
行 3:
源文件: z:\Smartpod\SP_HRM\OrgStru\CorpPerson.aspx 行: 1 这种错误做何解释?string类型和控件之间有什么转换?代码中的DropDownList如下:
<asp:DropDownList ID="HasChild" runat="server" Width="30%">
<asp:ListItem Value="0">无</asp:ListItem>
<asp:ListItem Value="1">有</asp:ListItem>
</asp:DropDownList>
这一种是控件中添加项得到的。<asp:DropDownList ID="CropKind" runat="server" DataSourceID="SqlDataSource1" DataTextField="Class_ChnName" DataValueField="Class_ChnName">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:SmartpodConnectionString %>"
SelectCommand="SELECT [Class_ChnName] FROM [B_Colligate] WHERE ([Class_Mark] = @Class_Mark)">
<SelectParameters>
<asp:Parameter DefaultValue="企业性质" Name="Class_Mark" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
这一种是和数据源绑定得到的。并且数据源测试连接通过。两种方式均在设计页面通过控件操作完成!出现如此问题实在郁闷!
解决方案 »
- 想问下谷姐goojje.com的整合百度和谷哥的搜索结果是怎么做的。
- 还是母版页问题
- 急!2005 webService 的问题。
- 我的问题很简单如何把字符串"我+你" 作为一个URL参数传给后台
- 一个关于sql分页打印的问题,在线等,高分求,帮忙解决的我会衷心的感谢!
- 子窗口中参数如何提交到父窗口
- 一个页面显示的小问题
- 兩問題:如何一次修改DataGrid當前頁所有記錄?大批量數據錄入有沒有類似Excel的控件:onMouseOver即編輯,onMouseOut即保存?
- 关于在代码绑定页中调用UserControl的问题
- 怎样将当前日期设置成如20030809这样的格式呢 ?
- asp.net可以做聊天室吗?(没分,不知怎么才能赚到分!!!)
- 这样获取ListBox的多个选择值?
仔细检查!cs代码也贴出来看看先
==========================================
查看賦值是是否忘掉了.SelectedValue
很正常啊!
B_Colligate.Class_ChnName列有"企业性质"的对应值?
<asp:Parameter DefaultValue="企业性质" Name="Class_Mark" Type="String" />
这个里面应该还有一个属性,让你选择这个参数是通过SEEION来传还是能过控件来传,楼主你这里注意一下看.
重新一步步创建的时候发现。感谢大家!