Custom Server Controls :: Extending A Control And Losing Values On Postback?

Nov 24, 2010

I've created loads of user controls, but this is my first time dealing with extending a server control. The problem I'm getting is that the base control's data is not being persisted across postbacks in a Master/Content page.I'm actually trying to get this working using a Telerik control (for my sins), but the same issue happens with a standard Web TextBox control. Code:

[Code]....

Now, I've copied the way I handle the control state as I do it with user controls (ControlState), and it isn't working. Can someone point me in the right direction please? All the examples I find refer to creating user controls, not extending existing controls. Specifically why nothing is being persisted on post back.

View 7 Replies


Similar Messages:

Custom Server Controls :: Extending Gridview Control?

Mar 24, 2011

I'm trying to extend GridView control following these steps:Create a namespace in an empty Visual Basic file: mycontrols.vb

[Code]....

Register it in the WebForm I want it to be

[Code]....

Create the control in my WebForm:

[Code]....

I get an error as tag prefix unknown, and in my code behind file, the control doesn't recognize the primitive GridView properties and methods.

View 3 Replies

Custom Server Controls :: Extending GridView Control (II)?

Mar 30, 2011

I'm trying to extend de GridView control with a Custom Server Control, I'm doing ok with extended properties but when I get to methods that need to re-apply or modifiy the DataSource I don't get any data in the grid, though the SQLDataSource actually retrieve data. Here is my MyGridView.applyFilter() method, which should filter the data but actually shows an empty GridView, but as I sayed, the DataSource has data. I try to find (FindControl) theSQLDataSource of the GridView (Me) and modifiy its paramters, thenDataBind Me to apply the changes...

[Code]....

What am I doing wrong? why is the gridview empty?

View 1 Replies

Custom Server Controls :: Extending GridView To Enforce It To Have A Specific Control?

Feb 23, 2011

I'm trying to extend the GridView into a custom/user control "WorklistGridView". And I'm not quite sure how to do it... so here's what I need:Every row needs to have a control (either a boundfield or a templatefield with a label, etc.) that contains the StepID (which is a column returned in the data set).I want to be able to use the WorklistGridView as a base class and extend it to something like "XyzWorklistGridView", where that child class would have a few more controls in the row template.

View 2 Replies

Custom Server Controls :: Custom Control's Children Do Not Persist Contents After Postback

Feb 25, 2011

I have created a really simple custom control to render panels into a page. The code is below. When I use my control and add any webcontrol to it, after each page postback the contents of these child controls vanishes.

I must have missed something really simple but run the example to reproduce this. Can anyone please enlighten me as to why the controls are being 'emptied' of their contents, and how I stop this occuring?

Here is the code for the control

[Code]....

And here's how I am using it in a sample page:

[Code]....

[Code]....

View 16 Replies

Custom Server Controls :: How To Add A Dropdownlist Of Available Values For A Custom Server Control Property

Sep 13, 2010

How would I add a (dropdown) list of available values for a custom server control property?

(Just like 'Visible' property of most controls has valid values of 'True/False' and nothing else can be entered or selected)

View 3 Replies

Custom Server Controls :: Extending GridView: New Behavior DefaultValue Not Working?

Mar 1, 2010

I an expanding on the HotGridView control (http://msdn.microsoft.com/en-us/magazine/cc163612.aspx). During testing I noticed the "AutoGenerateCheckBoxColumn" behavior was returning true even if the user did not specify the a value in the markup but I expect it to return False if not value is supplied by the user - can anyone shed some light on why the AutoGenerateCheckBoxColumn is always true if not explicitly set to False in the markup?

[Code]....

View 1 Replies

Custom Server Controls :: Inheriting From / Extending System.Web.UI.WebControls.Calendar?

Dec 16, 2010

This is my first "request for help" post - I've spent the past few weeks helping others, so I'm hoping someone can shed some light here.I've dealt with server controls before, so it's not new to me, but it was some time ago and I'm a bit rusty. I have an inherited calendar control, that works fine:

[Code]....

I've overriden the Render method, hoping to be able to modify the HTML output of the control - I want to hide the back arrow if the Month & Year in MinDate is reached in the calendar, and the same goes for MaxDate and the forward arrow.On top of this, I want to be able to display icons in the day cells, under certain data-bound conditions. Once I've figured one out, I'm sure I'll be able to work the other one out.Are there any other methods, events or properties more suitable for this? Are there any other controls that do what I'm looking for that I've maybe overlooked?I'm using C#.Net 4.0 Webforms - it's a very small app, so I've not used MVC etc... just a few LINQ queries to the database.

View 2 Replies

Custom Server Controls :: User Control Disappear And Reappear Some Time Later After Postback?

Jun 7, 2010

I'm getting some wierd behaviour with my User control. I've created User control & it has BUTTON which checks the validity of the number entered in the textbox of that user control. I have written Button Clik event handler in the USer Control code behind which checks the database table and tells valid or not. So far so good. In my application i dynamically add User controls. I make sure that I add them Page_Load so that for every postback UCs are visible. I'm ussing Session to save my UserControls. The problem starts at some point when i click the Validate button in the User Control all my user controls dissappear & after some postbacks all my controls appear. I don't know why this is happening. I have included my code for reference.

[Code]....

View 4 Replies

DropDownList Within Composite Control Is Losing Selected Value On Postback

Feb 23, 2010

I am building a composite server control that currently only has a TextBox and a DropDownList. Here is the code in all its foetal glory:

[Code]....

The control appears to work correctly across postbacks, that is until declarative values are set, e.g.:

<squee:Address runat="server" ID="a" Street="123 Fake St" State="VIC" />

After this, the text box continues to work correctly, but the _state member does not pick up the posted back values and instead just sticks to the declared value. I've checked the raw posted values in the Request object, and the new value for the list's UniqueID is there, but _state doesn't pick it up.

View 1 Replies

Custom Server Controls :: Custom Radio Button Loses State After Postback?

Mar 24, 2010

I have a custom radiobutton and it renders fine but loses state after postback.

How can it be modified?

[Code]....

View 1 Replies

Custom Server Controls :: Custom Tag Not Found For Control / Error: Unknown Server Tag 'custom:AjaxValidator'

Jan 3, 2011

Hope this is the correct forum for this question. I am using VWD 2010 an have a web project and get the following error upon execution:

Parser Error Message: Unknown server tag 'custom:AjaxValidator'.

My code is as follows in the .cs file:

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

View 1 Replies

Web Forms :: Getting Values From A Server Control Before Postback?

Aug 19, 2010

I created a ASP.Net page with dynamic controls. These controls are added by the user. In the Page_Load event a table is created with few controls.

When these dynamic controls do a postback, I can't get the values of these controls, because in my HTML code they are not available.

I only get the id of the control which triggers the postback. But I can't find it with the command FindControl. All other controls, which a are not added dynamicly are searchable.

View 5 Replies

Custom Server Controls :: How To Custom Controls Derived From Existing Controls - Overriding Default Property Values

Nov 15, 2010

I have some (probably very basic) questions about developing custom controls. I am wanting to derive a set of button controls, and the first one I have started on is a "DeleteButton", that has a additional property (DeleteConfirmationText) that is built into the OnClientClick attribute. To get that added, I overrode the Render method as follows:

[Code]....

This all works well. Now, I will add some logic to make sure that there is some text in the DeleteConfirmationText property, but that isn't the intent of my question.
What I am also wanting to do is to override some of the default property values, so I added that to the default constructor:

[Code]....

Now, in the designer in VS2008, and I look at the properties for the control, there isn't a default value shown in the "Properties" section, and the Causesvalidation still shows the underlying classes default value of "True". As well, in design mode, where the GridView control that containse my DeleteButton control would be displayed, there is an error box "There was an error rendering the control. 'Are you certain you want to delete this attorney?' cound not be set on property 'DeleteConfirmationText'. Here's the markup where I am defining the deletebutton control:

[Code]....

What am I doing wrong?

View 5 Replies

Custom Server Control Not Retaining Values After Post Back?

Apr 4, 2011

I have a custom server control (composite control having dynamically created dropdown boxes and textboxes). I have enabled AJAX in order to avoid page reload.The server control is used inside the ASP.NET webcontrol having few buttons which controls the visibility of the server control. Now I enter values in the dropdown box and texboxes and click on any other button. After this postback the last entered values are gone! The control is not remembering the values. How can I retain the values after post back?

View 4 Replies

To Create Unique Values For A Property In Custom Server Control?

Nov 12, 2010

I need a way to create unique values for a property in my custom server control..

In this case I will have the poroperty called "Name" and I neeed the value of Name to be unique for each "instance" of the control...

So for instance if I have a page with more then one instance of the control, I dont want the value of the Name property for these instances to be allowed to be the same..

...to put it kind of simple, if I dont remember this incorrect, I want it to be sort of like the ID property..but with another name then ID.

View 5 Replies

Custom Server Controls :: Custom Control's Constructor / User To Set That variable In The Properties Window After They Drag The Control Onto A Form?

Mar 4, 2010

I have a custom control which inherit from the Table class and in the constructor, it takes a an integer as an argument. There is no empty constructor.

Is there a way for the user to set that variable in the properties window after they drag the control onto a form.

I know some .NET controls, you can set the source for the parameter to different things like another control's property, QueryString using just the properties window.

Right now, I have to create the control dynamically. I read the query string and then created the object.

View 1 Replies

Custom Server Controls :: Paging And Sorting Gridview Custom Control Inside Of A Wizard Control?

Dec 24, 2010

here's a situation and I would appreciate your response.

I have programmatically created the Wizard control:

Page_Load(obj s, evargs e)
{
Wizard ClaimDetailWizard = new Wizard();
foreach(int item in selectedItems)
{
//create new step
//added custom control to new step
//add step to wizard
}
//added wizard to a placeholder on a page
}

Based on List I get from Session i added new steps to my wizard To each step I had added a custom control

Each custom control in tern contains another custom Gridview Control in it.

So here's the problem when the page loads for example for two steps. All is good Wizard does what it's supposed to do.

But when I try to use sorting or paging in that custom Gridview. Somehow it displays the gridview I should see in the next step of the wizard.

Also what I'm noticing through debugging. Is that when I press next in the wizard I go back to the original page where I do all of the code specified above, and it recreates the wizzard. But it goes to the next step. Is this the way wizard supposed to work? Just doesn't seem very efficient.

View 1 Replies

Custom Server Controls :: Video Tutorial Link For Composite And Rendered Custom Server Control?

Aug 20, 2010

i am new to technology so go easy on this post according to what i read from web there are 3 type of custom server controls 1 superclass2 composite 3 renderedi found video tutorial for superclass custom server control but couldnt find video tutials for other 2.lease forward me link for composite and rendered custom server controls video tutorial

View 1 Replies

What's The Best Method For Extending The Functionality Of A Standard Web Server Control

Nov 21, 2010

Currently my code resembles this:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="CustomPanel.ascx.cs"
CodeFile="CustomPanel.ascx.cs" CodeFileBaseClass="System.Web.UI.WebControls.Panel"
Inherits="MyProject.CustomPanel" %>
...
namespace MyProject
{ public partial class CustomPanel : System.Web.UI.WebControls.Panel
{ ... }
}

However, I'm really not sure how to proceed from here, because this does not appear to follow a logical inheritance path that includes System.Web.UI.UserControl / Am I doing something wrong? How can I inherit Panel and extend standard event-handlers, such as PreInit?

View 2 Replies

Custom Server Controls :: Add This Control To The Page,an Alert To Check The Text Value Of The Custom Control?

Dec 20, 2010

created a Custom Textbox Control that is intended to be a "masked date" textbox, so that I can handle different ways a user might enter in a date and make it work no matter what.I did this by creating a custom control with 3 separate Textboxes one for month,one for day one for year,then do some handling for different things that could be entered and it would all work.

The problem I am having is,when I add this control to the page,if I do an alert to check the Text value of the custom control it just gives me "[ServerControl1]" even if I enter in a date.

I tried doing an AutoPostback after entering so that it would refesh the Viewstate to have the values of the textboxes but the control doesnt seem to actually postback, even though I have it enabled.accessing the Textbox value after someoen
has entered a date?first custom control I have created and have been using google.

My Server Control Code is as follows:

[Code]...

View 1 Replies

Custom Server Controls :: Custom Server Control Rendering Method In Multiple Class?

May 17, 2010

I am creating custom server control. I have two classes in project. One is main class that render control and another will be used to render content based on condition.I just want to know how to render content from other classes in main class.For example. This isjust an example.My main class code

[Code]....

My TopLeftPane class

[Code]....

My page code on page load event

[Code]....

When I run the page, Header title always getting null. This is a just sample code. I will have more than 20 classes so I dont want to write a code in main class to render whole control.I hope all of you understand my problem.

View 3 Replies

Custom Server Controls :: TemplateField [TextBox] Binded To DataSource (Custom Server Control)?

Jul 28, 2010

Case : a templatefield Text Box created by class TemplateHandler and added to the composite

control Grid .how to bind it to the DataSource Object of the Grid Class ?

View 2 Replies

Custom Server Controls :: How To Use A Custom Server Control That Is Defined In Inline Code In The Same Page

Oct 22, 2010

I have to use inline code for an aspx page and I need to use a custom server control that is defined in the same aspx page but the control does not get processed as a server control. it gets returned as is as static html tag.

View 3 Replies

Custom Server Controls :: Custom Composite Control With Custom Templated Child Controls?

Mar 22, 2011

I am trying to build a custom composite control, which allows me to add custom content to each child control. It's a similar concept to what you have with a GridView and TemplateColumn. The markup used to place the control on the page would end up being something like this:

[Code]....

I have the code below, which allows me to put that markup on the page without throwing any errors, and it renders all the correct HTML, except it doesn't render the contents of the ColumnTemplate. I have replaced the Render() code with a comment because it's quite long winded and doesn't add anything important here:

[Code]....

I have tried to follow examples on MSDN and other forums but I can't make this work. I think I'm missing the code to render the contents of the template, but I don't know how to hook that up.

View 1 Replies







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