小编sm.*_*lah的帖子

Web用户控件通过XML填充项目

我有一个Web用户控件名称作为Chart Control,我在Chart Control中有一个下拉列表我想填充DropDown Chart Control of List Control,如下所示:

<UC:ChartControl ID="abc" runat="server">
        <ChartDropDownItems>
            <asp:ListItem Text="Graph_Amount_Items_Sold" Value="0"></asp:ListItem>
            <asp:ListItem Text="Graph_Ranking" Value="1"></asp:ListItem>
            <asp:ListItem Text="Graph_Share_Amount_Items_Sold" Value="2"></asp:ListItem>
            <asp:ListItem Text="Graph_Share_Unit_items_Sold" Value="3" Selected="True"></asp:ListItem>
            <asp:ListItem Text="Graph_Unit_items_Sold" Value="4"></asp:ListItem>
        </ChartDropDownItems>
    </UC:ChartControl>
Run Code Online (Sandbox Code Playgroud)

在.cs代码中

 [DefaultProperty("ChartDropDownItems"),
    ParseChildren(true, "ChartDropDownItems"), PersistChildren(false),
    ToolboxData("<{0}:ChartControl runat=\"server\"> </{0}:ChartControl>")]

    public partial class ChartControl : System.Web.UI.UserControl
    {
     private List<ListItem> lst;
            [Browsable(true)]
            [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
            [PersistenceMode(PersistenceMode.InnerProperty)]

            public List<ListItem> ChartDropDownItems
            {
                set
                {
                    lst = value;
                    Bind_ddChartChange();
                }
            }
     private void Bind_ddChartChange()
            {

                if (lst != null)
                {
                    ddChartChange.DataSource = lst;
                    ddChartChange.DataTextField = "Text";
                    ddChartChange.DataValueField = …
Run Code Online (Sandbox Code Playgroud)

asp.net web-user-controls

4
推荐指数
1
解决办法
712
查看次数

已添加具有相同键的项目.IIS WCF休息

我正在使用我的Asp.net应用程序托管WCF Rest服务,并且启用了asp.net兼容模式,当我从visual studio运行应用程序时工作正常但是当我在IIS7中访问End Point时出现错误时说"一个项目已添加相同的密钥." 我的服务代码是.

  [ServiceContract]
    [AspNetCompatibilityRequirements
    (RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]

    public class RestService
    {

        [OperationContract]
        [WebGet(UriTemplate = "Site/{Id}", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json)]
        public Site GetSite(string Id)
        {
            return new Site(1);
        }
}
Run Code Online (Sandbox Code Playgroud)

和全球ASCX是

   protected void Application_Start ()
        {
            RouteTable.Routes.Add(new ServiceRoute("Rest", new WebServiceHostFactory(), typeof(RestService)));

       }
Run Code Online (Sandbox Code Playgroud)

和web.config

     <system.serviceModel>
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>

        <standardEndpoints>
               <webHttpEndpoint>
                    <standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="false"/>
               </webHttpEndpoint>


        </standardEndpoints>
      </system.serviceModel>
Run Code Online (Sandbox Code Playgroud)

注意在VS2010模式下每个工作正常但在托管IIS 7和访问http://example.com/rest/site/2 任何建议时都会出错 ?

asp.net rest wcf iis-7

3
推荐指数
1
解决办法
3474
查看次数

make enter key作为Textbox上的Tab键

如何使用jQuery 使Enter密钥Tab在asp.net中成为关键的一个文本框?

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>

 <script type="text/javascript">
     $(document).ready(function () {

         var inputs = $(':input').keypress(function (e) {
             if (e.which == 13) {
                 e.preventDefault();
                 var nextInput = inputs.get(inputs.index(this) + 1);
                 if (nextInput) {
                     nextInput.focus();
                 }
             }
         });

     });                                    
 </script>     
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>

        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <asp:TextBox ID="TextBox2" runat="server" TabIndex="3"></asp:TextBox>

    </div>
    </form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

asp.net jquery

0
推荐指数
1
解决办法
2166
查看次数

标签 统计

asp.net ×3

iis-7 ×1

jquery ×1

rest ×1

wcf ×1

web-user-controls ×1