Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hello everyone -
I am trying to include user control which has a simple textbox, button and literal control.
The text in the textbox should be set in the literal control once user clicks the button but nothing is happening at this moment.
This is the content of the user control:
<%@ Control Language="C#" EnableViewState="true" AutoEventWireup="true" CodeBehind="FreeQuoteForm.ascx.cs" Inherits="UmbracoContacts.FreeQuoteForm" %><span style="color:Black">Your name:</span> <asp:TextBox style="border:1px solid" ID="txtName" runat="server" /> <asp:Button Text="Submit" ID="btnSubmit" runat="server" onclick="btnSubmit_Click" /><br /><span style="color:Black"><asp:Literal ID="litText" runat="server" /></span>
The code behind has this:
namespace UmbracoContacts{ public partial class FreeQuoteForm : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { litText.Text = "Enter Name"; } protected void btnSubmit_Click(object sender, EventArgs e) { litText.Text = txtName.Text; } }}
Once I am done with that part, I am uploading the usercontrol.ascx file in usercontrols folder and the dll of the project in the umbraco bin folder.
Here is the template file I am using:
<%@ Master Language="C#" MasterPageFile="~/umbraco/masterpages/default.master" AutoEventWireup="true" %><asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title><umbraco:Item field="pageName" runat="server" /></title> <!-- Font --> <link type="text/css" rel="stylesheet" href="http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz"> <!-- Style --> <link type="text/css" rel="Stylesheet" media="all" href="/css/Style.css" /> <link type="text/css" rel="Stylesheet" media="all" href="/css/Resset.css" /> <!-- Favicon --> <link rel="shortcut icon" type="image/x-icon" href="/media/69/Logo/favicon.png" /> <!-- Javascript --> <asp:ContentPlaceHolder ID="head" runat="server"> </asp:ContentPlaceHolder></head> <body class="bg"> <form id="form1" runat="server"> <!-- START Wrapper --> <div class="wrapper"> <!-- START Header --> <div class="header"> <div class="logo"> <!-- <a href="http://7a7.co"><img src="/media/74/logo.png" alt="7a7" /></a> --> </div> <div class="topnav"> <ul id="nav-sub"> </ul> </div> </div> <!-- END Header --> <!-- START Navigation --> <div class="navigation"> <ul class="nav"> </ul> </div> <!-- END Navigation --> <!-- START Left Sidebar --> <div class="left-sidebar"> <div class="tags-clients"> <h1><asp:Label ID="lblTagsTitle" runat="server" Text="Tags"></asp:Label></h1> <div class="content"> <ul class="list-tags"> </ul> </div> </div> <div class="our-clients"> <h1><asp:Label ID="lblOurClientsTitle" runat="server" Text="Our Clients"></asp:Label></h1> <div class="content"> </div> </div> <div class="cloud-clients"> </div> </div> <!-- END Left Sidebar --> <div class="main"> <asp:ContentPlaceHolder Id="contentPlaceholderPage" runat="server"> <!-- Insert default "contentPlaceholderPage" markup here --> </asp:ContentPlaceHolder> </div> <!-- START Footer --> <div class="footer"> </div> </div> <!-- END Footer --> </div> <!-- END Wrapper --> </form> </body></asp:Content>
You can find the page here: http://www.7a7.co/free-quote.aspx
Any help or advice will be helpful because this is dragging too much now and I really need to complete.
Thanks
Hi Arnaudov,
Try this one:
if (!IsPostBack)
{
litText.Text = "Enter Name";
}
Alex, same.
Doesn't help :(
EnableViewState="true"
Why you use this ?
ViewState is disabled in your site ?
try to add :
protected void Page_Init(object sender, System.EventArgs e) { this.EnableViewState = false; }
I removed the enableviewstate=true from the header of the user control, should I still add the page_init code?
Yes, please
do you enter in Click event in debug mode ?
I do when I am using the user control in local aspx page but not when I am using the control in the umbraco CMS :(
Alex what I noticed just know is when I am opening the source of http://www.7a7.co/free-quote.aspx I can see the form is not runat="server', although in the template as you can see I specified that the form is runat="server".
Maybe that might lead to something?
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
no action after postback in custom user control
Hello everyone -
I am trying to include user control which has a simple textbox, button and literal control.
The text in the textbox should be set in the literal control once user clicks the button but nothing is happening at this moment.
This is the content of the user control:
The code behind has this:
Once I am done with that part, I am uploading the usercontrol.ascx file in usercontrols folder and the dll of the project in the umbraco bin folder.
Here is the template file I am using:
You can find the page here: http://www.7a7.co/free-quote.aspx
Any help or advice will be helpful because this is dragging too much now and I really need to complete.
Thanks
Hi Arnaudov,
Try this one:
if (!IsPostBack)
{
litText.Text = "Enter Name";
}
Alex, same.
Doesn't help :(
Why you use this ?
ViewState is disabled in your site ?
try to add :
I removed the enableviewstate=true from the header of the user control, should I still add the page_init code?
Yes, please
do you enter in Click event in debug mode ?
I do when I am using the user control in local aspx page but not when I am using the control in the umbraco CMS :(
Alex what I noticed just know is when I am opening the source of http://www.7a7.co/free-quote.aspx I can see the form is not runat="server', although in the template as you can see I specified that the form is runat="server".
Maybe that might lead to something?
Thanks
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.