Web Forms :: Custom Editorpart - Createchildcontrols Called Before Applychanges?

Jan 18, 2010

I'm having the same issue as posted here:

http://forums.asp.net/p/1157529/1904541.aspx#1904541

I have a web user control that implements iWebEditable, and a custom editor part the implements EditorPart. In my custom editor part class, i define a text box, create the textbox in createchildcontrols() then render the textbox in RenderContents() using the following line:

_txtTitle.RenderControl(writer);

As soon as I add the line above (which displays the text box in the editor part) the functions createchildcontrols and applychanges are called in the wrong order. i click save button in the editor part to save changes to textbox, createchildcontrols() is called first, then applychanges() is called after the editorpart and the webpart (custom control) are rendered requiring me to refresh the page (which is not the desired functionality ;-] ). As soon as I comment out the line above in RenderContents() the functions are called in the correct order: appychanges() first, then createchildcontrols().

View 2 Replies


Similar Messages:

Custom Server Controls :: CreateChildControls Is Not Called?

Oct 12, 2010

I create a webcontrol (DefectsList as a gridview) with an icon that call an httphandler to open an other webcontrol (DefectEditor as an editor) but the CreateChildControls of the editor is not called!!

see the details below of DefectsList:

[Code]....

and the javascript:
[Code]....

see the details below of DefectEditor:
[Code]....


Why the CreateChildControls is not called, I think is due to the HttpHandler? so how to do?

View 6 Replies

How To Make Sure That CreateChildControls () Method Is Called When Unit Testing Custom .NET Web Controls

Feb 10, 2010

I want to unit test my rendering engine for an ASP.NET app. I have some custom controls created in that app. Most of those control rely on having CreateChildControls() method called by the ASP.Net engine wheather during initial call or a postback.When running a test CreateChildControls() does not get called and the control is in an "invalid" state.

As a workaround to get the tests going I explicitly call some other public method that calls EnsureChildControls() in it. This in effect causes CreateChildControls() to be executed and the control being initialized properly (just as it would normally when hosted on web server). I would like to get rid of that extra method call and the control to still be in a proper state for testing.

View 1 Replies

Javascript - .NET TextBox TextChanged Event Not Firing In Custom EditorPart

Jun 4, 2010

This is a classic sort of question, I suppose, but it seems that most people are interested in having the textbox cause a postback. I'm not. I just want the event to fire when a postback occurs.

I have created a webpart with a custom editorpart. The editorpart renders with a textbox and a button. Clicking the button causes a dialog to open. When the dialog is closed, it sets the value of the textbox via javascript and then does __doPostBack using the ClientID of the editorpart.

The postback happens, but the TextChanged event never fires, and I'm not sure if it's a problem with the way __doPostBack is invoked, or if it's because of the way I'm setting up the event handler, or something else. Here's what I think is the relevant portion of the code from the editorpart:

protected override void CreateChildControls()
{
_txtListUrl = new TextBox();

_txtListUrl.ID = "targetSPList";[code].....

View 1 Replies

Custom Server Controls :: Skinning With Call To CreateChildControls / New Buttons Are Not Created

Mar 24, 2010

I'm making a custom modal popup using a bunch divs where the programmer can set how many buttons thay want to apprear on said popup programatically using a function. It works. The only problem is that when the programmer specifies the number of buttons he/she wants it wipes out the skin information for the whole control. If I comment out the call to CreateChildControls the skin works fine, but the new buttons are not created.

In my CreateChildControls function the first thing it does is call Controls.Clear(). I assume this is what's wiping out the skin information, but it's kind of necessary to prevent controls with duplicate IDs.

View 6 Replies

Custom Server Controls :: Createchildcontrols Is Not Fired On Page Load Event?

Oct 1, 2010

i have develop a custom control as shown below

[Code]....

[Code]....

Now in page load event i am trying to a access textbox (txtData) of my custome control as shown below

[Code]....

View 3 Replies

State Management :: Custom Control: State Restoring For Controls Created With CreateChildControls

Dec 22, 2010

Let me explain, describing the scenario:In a custom server control (in my case, derived from CompositeControl), in the overidden CreateChildControls method I create a complex tree of subcontrols, using information from a db.The db provides both information on which controls I need to create (the user interface's structure) and the data used to fill these controls.Than the user can interact with the control and change the data (that becomes different to what stored on db).

My custom control lives in the same page where there are other controls, obviously.And these controls can cause a postback at any time.What I need is that my custom control keeps the data entered by the user across these postback, without reverting to the original data and loose the user data entry.

Here is the first doubt:

1)I create the subcontrols dinamically in the CreateChildControls at any page refresh (both on first call than on postback).I know that the framework solves the reference between the posted data and the controls I create in the CreateChildControls in order to set properties and raise control events, but can you tell me when and how it actually does this? In which phase of page life cycle? What happens after the CreateChildControls?

A second doubt:2)If the user interface structure must change as a consequence of the data entered, I had to execute CreateChildControls twice (the first time to recreate the original interface to get the events and the second time to create the new interface)
In which phase of page/control lifecycle do I have to make the second call to CreateChildControls? I do it on Prerender now, but is it right or wrong, and why?

View 1 Replies

Web Forms :: Custom Validator Is Not Getting Called?

Jan 20, 2011

here is the code "when i select a value from calender customvalidator is not called . . "

[Code]....

View 7 Replies

WCF / ASMX :: Custom UserNamePasswordValidator Never Called

Jan 19, 2011

I have a problem with custom authentication over https. What I need is a secure channel and authenitcation on message level. I got it working quite well, but my custom validator never gets called when I send a message to the web service using SoapUI. The service is called, however the Validate method in the custom validator is never called. The validator is available for the runtime, I have checked by misspelling the type in customUserNamePasswordValidatorType which caused an exception saying it could not find type when I accessed the WSDL.

Here's my config:

[Code]....

View 3 Replies

How To Update Zone And ZoneIndex In An EditorPart

Mar 30, 2010

I created a custom EditorPart, and I want to set the Zone and ZoneIndex on the WebPartToEdit in the ApplyChanges method. However, these particular properties are read-only, so I can't set them. The LayoutEditor contains these properties, so it should be possible to update them. How can I set the Zone and ZoneIndex on a WebPart?

View 1 Replies

Why Does Controls.Add Called Inside Custom Control Adds The Validator To The Parent Page

Jan 2, 2010

there is a sample code for creating a custom textbox control with built in validation posted here Building ASP.NET TextBox with Integrated Validation And Switchable Input Modes. Inside the code there is a call to Controls.Add(validator) which adds the asp.net validator control to the textbox. when the textbox is used on the page, the validator is rendered to the page although the validator is added to the textbox and not to the page!

View 1 Replies

CreateChildControls Method ChildControls Do Not Fire Events?

Mar 22, 2011

I have created a custom web control. In that control on CreateChildControls method i dynamically create a Table add rows to it which contains a ImageButton and i am trying to attach an event to this ImageButton but the event never fires?

I tried on Init method too it does not work . The code goes like this on CreateChildControls

I create a Panel . The i create a table with data and an imagebutton on it I add this table to the created panel I add this Panel to the Controls.Add method.

I have also observed that if i add a control directly to the Controls.Add() method and attach an event it works fine .

Meaning ,

1. Create a button attach an event handler

2. Add to the Controls.Add() method

On doing the above it works fine . Only the child controls events do not get fired is there anything that i am missing ??

View 1 Replies

Custom Server Controls :: Server Control Pre_Render Called Twice?

Nov 15, 2010

I have a weird design. I have page called A, it has control called C1 which has a control called C1-1 which has a control called C-1-1-1. C-1-1-1 is inside a modal popup extender. Whenever their is a postback, the C-1-1-1 's Pre_Render is called twice, first with the correct values and parameters which seem right. And second with all values seemingly reset (sounds like a new object construction).

View 2 Replies

MVC :: Custom Validation Attribute Is Not Called By Validation Mechanism?

Aug 28, 2010

Custom Validation Attribute is not called by validation mechanism?

[Code]....

ViewModel

[Code]....

View 3 Replies

Web Forms :: When Is Application_BeginRequest Called?

Sep 2, 2010

I have two versions of a website. One runs on IIS server on a local PC, the other runs on the ASP.NET development environment included on Visual Studio (localhost). Apart from that, the file stucture of both is the same, although only the one running on IIS works properly, and this seems to be related to the fact that the IIS version calls Application_BeginRequest() where the other doesn't.

I've looked at the differences between IIS server and the ASP development environment in: [URL], and it says that IIS and the ASP development server deal with static content in that for IIS in that on IIS static content does not go through the ASP.NET runtime like it does on the dev environment (but I'm not sure exactly what this means).

I've done a number of tests involving images, etc, and have noticed that when the image is of the form:

<img src="Image/MyImage.jpg...>

the IIS server version calls Application_BeginRequest(), but the visual studio development environment version doesn't.

However, if I change the above code to use:

<img src="<%=ResolveUrl("~/Image/MyImage.jpg")%>" ...>

it will call Application_BeginRequest().

In my case, it is necessary to call Application_BeginRequest because this creates a new path and calls
RewritePath().

The problem occurs when using links such as <a href="..." ...>, because if I use static content it won't call Application_BeginRequest() and the path won't be re-written. But If I change it to href=" %=ResolveUrl("~/...")%>" (for some reason, it will only call BeginRequest() if the path begins with a tilde ~), the path is re-written incorrectly.

I'm not really sure how to find out why the IIS version is calling Application_BeginRequest() from all the time (the callstack just says "external code"), or why it is calling it whereas the local dev server version isn't.

If anybody can explain this, or knows of any sites that go into this so I can master the basics, I'd be very grateful.

View 6 Replies

Web Forms :: Page_Load Not Being Called?

Jan 19, 2011

Please have a look at my VB/ASP code and tell me if you can see what's wrong (I have bolded the important segments):

[code]...

Basically, I'm trying to get the Page_Load subroutine to execute on the page load, but it doesn't seem to be called. I'm assuming that because I set my feedback label to "feedback" in the Page_Load subroutine, I should see it displayed on the page saying"feedback" on first loading the page and every time I refresh. But this doesn't happen. I'm lead to conclude that the Page_Load subroutine is not being called on the page load.

View 1 Replies

Web Forms :: How Come A Null Session Value That Is Called

Sep 13, 2010

how come a Null session value that is called, doesn't get directed to the Custom Error Page?

View 4 Replies

Web Forms :: RegisterForEventValidation Can Only Be Called During Render?

Jun 21, 2010

I am having an strange issue with ASP.NET Master page. I have a dynamic resolution to an image URL

<img src='<%=ResolveUrl("~/images/Generator.gif") %>' />

Sometimes it works, most of the time it generate a crash with the following error

RegisterForEventValidation can only be called during Render();
Description: An unhandled exception occurred during the execution of the current web request. Please
review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: RegisterForEventValidation can only be called during Render();

View 3 Replies

Web Forms :: Why Page_load Is Called Twice In Web Application

Mar 29, 2010

Initially in my website page_load for the landing page say test.aspx was called twice everytime when it was getting loaded. Since my application is an upgraded one (from VS 2003 to VS 2005/2008), I commented the "this.load" event in InitializeComponent and it is working fine, when user first logs in, into my web application. But then, whenever user navigates to this page from any other page in my application, page_load gets called twice.

View 9 Replies

Web Forms :: Page_load Of Webusercontrol Called Twice?

May 5, 2010

I have a page, which load a tab with usercontrol this usercontrol inturn loads an another usercontrol that has treeview. Issue: On (!Postback) of treeview control page_load, this load is gettting called twice. it is not callign the page_load of page but just the control page_load twice.

Tried: changed autoevenwireup from false to true, true to false (no change) Add/Remove of EnableViewState="true" ViewStateMode="Inherit" doesn't make any difference.

but if i add another usercontrolB and load that instead of this controlA, the ControlA still gets called on page_load once and ControlB also once.

View 2 Replies

Web Forms :: Asp:DropDownList Function Not Being Called?

Dec 8, 2010

I have a dropdownlist on a web form that isn't calling a routine when I click on a new item in the dropdown.Here's my code from the .aspx file

[Code]....
[Code]....

My list is populated with a blank item as the 1st entry and then all the alerts that I have in my database. I originally had OnSelectedIndexChanged but that didn't work either.

View 4 Replies

Web Forms :: Page_init Called Twice / How To Find Its Reason

Jun 11, 2010

I was working on something with Page_Init. I palce a break point and noticed the event is called twice. What happen was:

1) Page_Init is called

2) Page rendered on browser

3) Page_Init is called again

How do I find out what is casuing it to fire twice? Page_load is also firing twice and this is happening on IE.

View 9 Replies

Web Forms :: Why The Method LoadViewState() Is Not Called After The Postback

Sep 7, 2010

I can't understand why the method LoadViewState() is not called after the postback in my code below.After label1 cahnges its text the "__VIEWSTATE" hidden field is modified, but LoadViewState() is not called.

[Code]....

View 3 Replies

Web Forms :: Button Click Event Not Getting Called Due To Tag?

Feb 23, 2010

In my web form, i am having button named "btnSave" and there are some textbox controls (to name few, Emp Number, Full Name, etc). I've added RegexValidator to the textbox controls as below:

<asp:RegularExpressionValidator
ID="employeeNumberValidator"
ValidationExpression="^[0-9]+$"
ControlToValidate="txtEmpNumber"
ErrorMessage="Only integers are allowed"
runat="server">
</asp:RegularExpressionValidator>

This RegexValidator will check for emp number textbox contains only integers and if not, it will display message "Only integers are allowed". Now, in my btnSave_Click(...) event, i am first validating whether the textbox contains data and if not, then i am highlighting the textbox in red. When txtEmpNumber contains non-integers data and if i click the Save button, the code in inside btnSave_Click(...) event is not getting called. But when i provide employee number in expected format and then click Save button, then the code inside button click event is getting called without any issues.

I am not sure why my btnSave_Click(...) is not functioning when Employee Number has data in incorrect format.

View 5 Replies

Web Forms :: Button Click Event Is Not Getting Called Up?

Jul 17, 2010

I have a situation in which i have a textbox which has a text_changed event. User enters the value in textbox, presses 'tab' after that text changed event gets fired it makes bit calculation, after that user clicks the button to save value in database. Problem arises if user does not press tab or click outside the textbox after filling the textbox and presses the submit button. text change event gets fired but not button click, user has to click the button again.

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved