在母版页和其他ascx页中使用相同的控件 [英] Using same control in master page and other ascx page

查看:95
本文介绍了在母版页和其他ascx页中使用相同的控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(Footer.ascx页)
对于新闻信:

 <   div      ="  span> > 
                <   span     ="   topic-header" <  > 
                <   div     ="  子块" <   p     ="  标题" <  > 新闻通讯<  /strong   >  <  /p  > 
                    <   p  > 获取电子邮件警报在线交易和店内优惠!<  /p  > ; 
                     <%-< nopCommerce:注册ID = "  signup1" runat =  服务器"/> -%> 
                     <   nopCommerce:注册    ID     ="     runat   =" 服务器" / > 

                <  /div  >  



(Three.master页面)
订阅:

 <   div      ="  span> > 
                <   p  > 订阅<   strong  >  OFFERS <  /strong  >  /p  <%-<输入 class  = " 新闻稿itl" "  输入电子邮件地址" type =  文本" span> onfocus = "  onblur = " ><!-pp修改的分类以及在foucs和onblur上添加的事件->
                    < input  = "   = "  type = "  > 



                  ***********在10月6日添加 2012  ***********-<   asp:ContentPlaceHolder     ID   ="   runat   服务器" > 
             <   nopCommerce:注册    ID   ="   runat   服务器" / <  /asp:ContentPlaceHolder  > 


            <  /div  >  




我的问题是我们可以像在主n页脚页面中一样在两个不同的文件中使用相同的nopcommerce:signup吗,但问题是,当我单击提交按钮以进行订阅时,它没有进入下一页,但是当我单击时解决方案

将相同的控件添加到一页以上(尽管Footer.ascx)是一个用户控件)绝对不能成为问题.

无论如何,我不认为您将控件添加到母版页的方式是正确的.您已将"nopCommerce:signup"控件放置在母版页的contentplaceholder中.将内容占位符添加到母版页,以便Webcontent表单可以使用内容控件(例如:

 <     ="   cph3" / >  

)放置自己的html.

您必须将Web内容表单添加到项目中,指定母版页,然后将控件添加到添加的Web内容表单中.

如果还有其他问题,请提供有关如何使用Footer.ascx和Three.master显示

 <   nopcommerce:注册    id   注册"    runat   ="    / >  


(Footer.ascx page)
For News letter :

<div class="latest-updates">
                <span class="topic-header">Updates on Latest Deals</span>
                <div class="sub-blocks">
                    <p class="heading">Subscribe for <strong>Newsletter</strong></p>
                    <p>Get email alerts for online deals and instore offers!</p>
                     <%--<nopCommerce:signup ID="signup1" runat="server" /> --%>
                     <nopCommerce:signup ID ="sign" runat="server" />

                </div>



(Three.master page)
For Subscription :

<div class="newsletter-wrapper">
                <p>SUBSCRIBE FOR <strong>OFFERS</strong></p>

                <%--    <input class="newsletter itl" value="Enter Email Address" type="text" onfocus="focussed(this);" onblur="blurred(this);"><!-- pp modifed  clas itl and events added  on foucs and onblur-->
                    <input class="subscribe" value="" type="submit">



                  *********** Added on 6th oct 2012 ***********--%>


              <asp:ContentPlaceHolder ID="cph3" runat="server" >
             <nopCommerce:signup ID="signup" runat="server" />
              </asp:ContentPlaceHolder>


            </div>




My question is can we use the same nopcommerce:signup in two different files as i did in master n footer page , but the problem is when i clk on submit button for subscription it does not go to next page but where as whn i click on newletter submit button it gives me the next page can any have any idea how to resolve this?

解决方案

Adding the same control to more than one page(though Footer.ascx is a user control) must not be an issue.

Anyway i dont think the way you have added the control to the master page is correct. You have placed the ''nopCommerce:signup'' control inside a contentplaceholder in the master page. Content placeholders are added to master pages so that Webcontent Forms can use content controls (eg:

<asp:content contentplaceholderid="cph3" />

) to place its own html.

You must add a web content form to your project, specify the master page and then add your control into the added web content form.

If something else is the issue please provide more details regarding how you are using Footer.ascx and Three.master to display

<nopcommerce:signup id="signup"  runat="server" />


这篇关于在母版页和其他ascx页中使用相同的控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆