RE : Beginners Nightmare .... PLEASE helphttp://forums.asp.net/t/1605148.aspx/1?RE+Beginners+Nightmare+PLEASE+helpWed, 22 Sep 2010 22:44:01 -040016051484092239http://forums.asp.net/p/1605148/4092239.aspx/1?RE+Beginners+Nightmare+PLEASE+helpRE : Beginners Nightmare .... PLEASE help <p>I have just started learning the ins and outs of ASP.Net and am running Web Matrix while getting to grips with the formatting etc.</p> <p>My problem is that any time i add a textbox webcontrol to a page, instead of displaying the actual textbox I get an 'Error Rendering Control' box stating that 'RegisterForEventValidation can only be called during Render()'!!!</p> <p>I am at a loss as to why this is happening, which isn't just restricted to the textbox webcontrol but ALL the control's available except the Label &amp; Literal webcontrols which seem to behave properly.</p> <p>Could someone please please please provide some guidance for this newbie to ASP.Net in order that I can keep the current enthusiasm going to learn.</p> <p>&nbsp;</p> <p>Thanks so much in advance</p> 2010-09-22T10:44:14-04:004092262http://forums.asp.net/p/1605148/4092262.aspx/1?Re+RE+Beginners+Nightmare+PLEASE+helpRe: RE : Beginners Nightmare .... PLEASE help <p>Could you post your code, will be easier to debug&nbsp;</p> 2010-09-22T10:58:58-04:004092268http://forums.asp.net/p/1605148/4092268.aspx/1?Re+RE+Beginners+Nightmare+PLEASE+helpRe: RE : Beginners Nightmare .... PLEASE help <p>&nbsp;Hi,</p> <p>Can you provide some of you code so I can take a look at it. </p> 2010-09-22T11:00:15-04:004092281http://forums.asp.net/p/1605148/4092281.aspx/1?Re+RE+Beginners+Nightmare+PLEASE+helpRe: RE : Beginners Nightmare .... PLEASE help <p>Hi the code is pasted below, VERY simple piece of code to place the current date &amp; time into a textbox webcontrol.</p> <p>The error originates on the actual webcontrol object when i place it in design view from the toolbox.</p> <p>&lt;%@ Page Language=&quot;VB&quot; %&gt;<br> &lt;script runat=&quot;server&quot;&gt;</p> <p>&nbsp;&nbsp;&nbsp; Sub Page_Load(sender as Object, e as EventArgs)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; currentDT.Value = DateTime.Now<br> &nbsp;&nbsp;&nbsp; End Sub</p> <p>&lt;/script&gt;<br> &lt;html&gt;<br> &lt;head&gt;<br> &lt;/head&gt;<br> &lt;body&gt;<br> &nbsp;&nbsp;&nbsp; &lt;form runat=&quot;server&quot;&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:TextBox id=&quot;currentDT&quot; runat=&quot;server&quot;&gt;&lt;/asp:TextBox&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;!-- Insert content here --&gt;<br> &nbsp;&nbsp;&nbsp; &lt;/form&gt;<br> &lt;/body&gt;<br> &lt;/html&gt;</p> <p>&nbsp;</p> <p>The compilation error points to line 5 of the code and states ---&gt; &quot;<b style="margin-top:-5px; font-weight:bold; color:black; font-family:Verdana">Compiler Error Message:&nbsp;<span></span></b>BC30456: 'Value' is not a member of 'System.Web.UI.WebControls.TextBox'.&quot;<span></span><span></span></p> 2010-09-22T11:11:39-04:004092287http://forums.asp.net/p/1605148/4092287.aspx/1?Re+RE+Beginners+Nightmare+PLEASE+helpRe: RE : Beginners Nightmare .... PLEASE help <p>If you&nbsp;want to get a value to the textbox you are not able to do it in the page_load event. You can set the time in the Page_PreRender event. It is the exact same as the page_load syntax you just put Page_PreRender. It happens after the page_load event. In the Page_load event the&nbsp;textbox&nbsp;does not exist yet. &nbsp;</p> 2010-09-22T11:17:38-04:004092290http://forums.asp.net/p/1605148/4092290.aspx/1?Re+RE+Beginners+Nightmare+PLEASE+helpRe: RE : Beginners Nightmare .... PLEASE help <p>change:</p> <p>currentDT.Value = DateTime.Now<br> </p> <p>to</p> <p>currentDT.Text = DateTime.Now<br> &nbsp;</p> 2010-09-22T11:18:40-04:004092292http://forums.asp.net/p/1605148/4092292.aspx/1?Re+RE+Beginners+Nightmare+PLEASE+helpRe: RE : Beginners Nightmare .... PLEASE help <p>Also just looking at it. You are&nbsp;using Textbox.Value = It should be Textbox.Text. And to convert the&nbsp;time to&nbsp;a string use the Convert.ToString method. This is a c# method. I don't use visual basic and never have&nbsp;so I don't know the syntax for it. But you&nbsp;may have to cast you time to&nbsp;a string I don't know for sure with visual basic. If you are learning you may want to think of learning c#. Alot of programmers have to learn c# a couple of years after visual as it is a better language with more features. &nbsp;</p> 2010-09-22T11:20:37-04:004092301http://forums.asp.net/p/1605148/4092301.aspx/1?Re+RE+Beginners+Nightmare+PLEASE+helpRe: RE : Beginners Nightmare .... PLEASE help <p>Hi <a href="http://forums.asp.net/members/seamus1982.aspx">seamus1982</a>,</p> <p><span style="font-family:Verdana; color:black; font-size:9pt">Wrong on booth things,&nbsp;the controls are available on page load, and c# and vb&nbsp;have the same features, main difference is syntax.&nbsp; However it's good to learn both as they are both used widely across industries.&nbsp;&lt;:o:p&gt;</span></p> 2010-09-22T11:25:45-04:004092307http://forums.asp.net/p/1605148/4092307.aspx/1?Re+RE+Beginners+Nightmare+PLEASE+helpRe: RE : Beginners Nightmare .... PLEASE help <p>Thanks guys, the&nbsp;changing the property to Text instead of Value worked but my (other) main issue is in the web matrix design screen when&nbsp;I try to add a web control fro the toolbox.&nbsp; When I place the textbox on the design pane I get the following :</p> <p>&quot;Error Rendering Control - currentDT&nbsp; An unhandled exception has occured.&nbsp; RegisterForEventValidation can only be called during Render()&quot;</p> <p>As a newbie to this it might be a minor annoyance to others but I was expecting an actual text box to be displayed.</p> <p>Any explanation/help on this would be greatly appreciated.</p> <p>Thanks again for helping me out with the code :)</p> 2010-09-22T11:33:07-04:004092308http://forums.asp.net/p/1605148/4092308.aspx/1?Re+RE+Beginners+Nightmare+PLEASE+helpRe: RE : Beginners Nightmare .... PLEASE help <p>Right if you want&nbsp;to correct me.&nbsp;The&nbsp;textbox is&nbsp;created in the pageload event. So if you&nbsp;want&nbsp;to&nbsp;insert data into the textbox programmatically in the page_load event this often&nbsp;causes errors. i.e the error message&nbsp;with this can only be done in the render event. </p> <p>Secondly&nbsp;there are more&nbsp;features with c#. ie. operator overloading, alot more error&nbsp;catching&nbsp;features and there are more. I don't get why someone would correct me if they don't&nbsp;know for certain. &nbsp;</p> 2010-09-22T11:33:22-04:004092314http://forums.asp.net/p/1605148/4092314.aspx/1?Re+RE+Beginners+Nightmare+PLEASE+helpRe: RE : Beginners Nightmare .... PLEASE help <p></p> <blockquote><span class="icon-blockquote"></span> <h4>MasterToad</h4> <p>Thanks guys, the&nbsp;changing the property to Text instead of Value worked but my (other) main issue is in the web matrix design screen when&nbsp;I try to add a web control fro the toolbox.&nbsp; When I place the textbox on the design pane I get the following :</p> <p>&quot;Error Rendering Control - currentDT&nbsp; An unhandled exception has occured.&nbsp; RegisterForEventValidation can only be called during Render()&quot;</p> <p>As a newbie to this it might be a minor annoyance to others but I was expecting an actual text box to be displayed.</p> <p>Any explanation/help on this would be greatly appreciated.</p> <p>Thanks again for helping me out with the code :)</p> <p></p> </blockquote> &nbsp; <p></p> <p>Hi, </p> <p>If you put the code in your page_load event into the Page_PreRender event. That should work. So you just copy your code in the page_load event and put it into a different event. The Page_PreRender event or thhe Page_PreRenderComplete event. Everything should work properly then. </p> <p></p> 2010-09-22T11:36:31-04:004092326http://forums.asp.net/p/1605148/4092326.aspx/1?Re+RE+Beginners+Nightmare+PLEASE+helpRe: RE : Beginners Nightmare .... PLEASE help <p>What development tool are you using?&nbsp;</p> 2010-09-22T11:43:38-04:004092351http://forums.asp.net/p/1605148/4092351.aspx/1?Re+RE+Beginners+Nightmare+PLEASE+helpRe: RE : Beginners Nightmare .... PLEASE help <p>ASP.Net Web Matrix, as I said the main issue i have with this is NOT the coding itself&nbsp;but the actual display of a toolbox object in the design screen not being displayed but instead an error_message being given.&nbsp; The only two objects that appear on the desing screen properly are the Label &amp; Literal objects, all other objects produce the same error message (as mentioned earlier).</p> <p>On running the code everything works (and looks) fine.</p> <p>&nbsp;</p> <p>&nbsp;</p> 2010-09-22T12:04:08-04:004092432http://forums.asp.net/p/1605148/4092432.aspx/1?Re+RE+Beginners+Nightmare+PLEASE+helpRe: RE : Beginners Nightmare .... PLEASE help <p>Do you not have the ability to use web developer express?<br> <br> I've never used Webmatrix as a developer tool and what you are describing sounds&nbsp;like a bug in webmatrix.&nbsp; Poss worth another post in a different forum/category.&nbsp;</p> 2010-09-22T12:44:25-04:004092473http://forums.asp.net/p/1605148/4092473.aspx/1?Re+RE+Beginners+Nightmare+PLEASE+helpRe: RE : Beginners Nightmare .... PLEASE help <p>Are the objects that are not showing the objects that you are creating the input dynamically. Try creating the page without programmatically entering data into them. Then&nbsp;they should show up.&nbsp;If you want to programmatically put data into the&nbsp;do it in the page_prerender event rather than the page_load event. Have you tried putting the code into the page_prerender event? More than likely this is the issue. </p> 2010-09-22T13:03:42-04:004093005http://forums.asp.net/p/1605148/4093005.aspx/1?Re+RE+Beginners+Nightmare+PLEASE+helpRe: RE : Beginners Nightmare .... PLEASE help <p></p> <blockquote><span class="icon-blockquote"></span> <h4>MasterToad</h4> ASP.Net Web Matrix</blockquote> <p></p> <p>I agree with cookie_powered. I recommend that you stop using Web Matrix for Web Forms development, especially as you are just learning. If you like Web Forms, and feel comfortable dragging controls onto a design surface etc, use <a href="http://www.asp.net/downloads">Visual Studio 2010 Express</a> (which is free).</p> <p>WebMatrix is a beta product that has been designed primarily to provide a different development paradigm - Web Pages. It works best with the Razor syntax and vbhtml or cshtml pages. It has bugs which will be addressed in the next beta, which will also have bugs no doubt, but for a beginner, I would recommend it.</p> <p><a href="http://www.mikesdotnetting.com/Article/145/Introducing-WebMatrix-An-Easier-Way-To-Do-ASP.NET">http://www.mikesdotnetting.com/Article/145/Introducing-WebMatrix-An-Easier-Way-To-Do-ASP.NET</a><br> <a href="http://www.mikesdotnetting.com/Article/146/WebMatrix-A-First-Application">http://www.mikesdotnetting.com/Article/146/WebMatrix-A-First-Application</a><br> </p> <p><br> </p> 2010-09-22T17:36:32-04:004093500http://forums.asp.net/p/1605148/4093500.aspx/1?Re+RE+Beginners+Nightmare+PLEASE+helpRe: RE : Beginners Nightmare .... PLEASE help <p>Not sure MasterToad is using WebMatrix or Visual&nbsp;Web Developer.</p> <p>You mention adding things to a design view, but that&nbsp;only&nbsp;exists in Visual Web Developer or Visual Studio.</p> <p>If you're looking at something like this:</p> <p><a href="http://www.microsoft.com/express/s/img/VWD2010Start.png">http://www.microsoft.com/express/s/img/VWD2010Start.png</a></p> <p>Then you're in Visual Web Developer.&nbsp;&nbsp;Not sure why that error message would appear when you drag a text box onto the design view, though...</p> 2010-09-22T22:44:01-04:00