Unable To Set A Property On A Custom Dropdownlist

Oct 26, 2010

I'm trying to set a property on a custom DropDownList:

<custom:ReferenceDropDownList ... ValidityDate="<%# Application.CreateDate %>" />

Even though I can see that Application.CreateDate has been set in the Page_Load method on the containing UserControl, the code-behind in the DDL never seems to pick it up.

protected override void OnLoad(EventArgs e)
{
// this.ValidityDate is always null
}

This is even the case with ValidityDate="<%# DateTime.Now %>". The property of the DDL is declared like this:

[Category("Data")]
[DefaultValue(null)]
public DateTime? ValidityDate { get; set; }

what is the correct sequence I should be following here. I thought that a DDL would evaluate a cynamic property value like that without too much trouble.

View 1 Replies


Similar Messages:

Web Forms :: Unable To Set Text Property Within Custom Control

Feb 25, 2011

I don't seem to be able to set the Text property within this custom control. Even though I set the Text property in code-behind, when I refresh the web form, only the default message is shown.

[Code]....

View 1 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 :: Binding UserControl Property To Page Property?

Sep 15, 2010

So what I'm trying to accomplish is this

[Code]....

The user control has public properties named accordingly and the page has protected properties accordingly which I've verified have the desired values.

For some reason the values are always empty strings or 0s in the usercontrol, no matter what the page property is.

View 1 Replies

Custom Server Controls :: Insert A Drop List Property Into A Custom Webcontrol?

Feb 18, 2010

How insert a drop list property into a custom webcontrol? This a drop list property is show all textbox control on usercontrol or webpage.

View 3 Replies

Custom Server Controls :: Custom Checkbox Control 'checked' Property Is Not Working?

Sep 3, 2010

Iam developing a custom checkbox control deriving from the 'compositecontrol' which i need to use it for a composite control purpose.

public
class
TngCheckBox :
CompositeControl
{

i have written the required properties which are working fine except the "checked" property. here is my code for 'checked' property. i tried both the below ways (commented one and not commneted) . the problem is the 'checked' value is not setting the value at the get set part of the property.its assigning the value at the design time , but when i check and uncheck its not updating the property value.which is resulting me wrong .

[Code]....

View 2 Replies

Custom Server Controls :: Custom Checkbox Control 'checked' Property Is Not Working ?

Oct 15, 2010

Iam developing a custom checkbox control deriving from the 'compositecontrol' which i need to use it for a composite control purpose.

public
class
TngCheckBox :
CompositeControl
{

i have written the required properties which are working fine except the "checked" property. here is my code for 'checked' property. i tried both the below ways (commented one and not commneted) . the problem is the 'checked' value is not setting the value at the get set part of the property.its assigning the value at the design time , but when i check and uncheck its not updating the property value.which is resulting me wrong .

[Code]....

View 4 Replies

Custom Server Controls :: List Property Of A Custom Control Is Not Persisted?

Mar 15, 2010

I have a custom control, inherited from Button. This is the class definition for the control and 2 properties:

[Code]....

I show you 2 properties, only to illustrate the problem.

as you see Aplicacion property is of a custom type Sistema, and Roles property is of type List<UserRol>.

The Aplicacion property is rendered well, this way:

[Code]....

The problem I have is with List<UserRol>. I couldn't get it to be rendered. I expeect to be rendered this way:

[Code]....

Finally, this is the TypeConverter and Editor definitions for the list:

[Code]....


The UserRol class is a typical class, without any special attributes.

I have discovered that when I use the custom editor for Roles property, the collection is not persisted. When I use the default editor for the collection, the collection is persisted.

View 1 Replies

Custom Server Controls :: Need Custom Text Box Control With DataSource,TableName,ColumnName Property?

Nov 26, 2010

I need to create one custom text box control which should be bind with data base.

I am referring following link...

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.databoundcontrol.aspx

I used DataBoundControl to create my control but i am not able to do it properly.

public class SimpleTextBoxControl : DataBoundControl
{
private TextBox nameTextBox;
public string DataTextField
{
get
{
object o = ViewState["DataTextField"];
return ((o == null) ? string.Empty : (string)o);
}
set
{
ViewState["DataTextField"] = value;
}
}
[
Bindable(true),
Category("Data"),
DefaultValue(""),
Description("The text to display on the link."),
Localizable(true),
PersistenceMode(PersistenceMode.InnerDefaultProperty)
]
public virtual string DataTexValue
{
get
{
string s = (string)ViewState["Text"];
return (s == null) ? String.Empty : s;
}
set
{
ViewState["Text"] = value;
}
}
protected override void PerformDataBinding(IEnumerable retrievedData)
{
if (retrievedData == null)
return;
base.PerformDataBinding(retrievedData);
Controls.Clear();
nameTextBox = new TextBox { ID = "nameTextBox" };
foreach (object dataItem in retrievedData)
{
if (DataTextField.Length > 0)
{
nameTextBox.Text = DataBinder.GetPropertyValue(dataItem, DataTextField, null);
}
DataTexValue = nameTextBox.Text;
}
this.Controls.Add(nameTextBox);
}
}

View 1 Replies

Custom Server Controls :: How To Create Custom Property (DataSource) In Custom Controls

May 15, 2010

I know that how to create custom control and add custom property.

I want to create property like DataSource to my custom control.

View 1 Replies

Add Custom Property To Custom Server Control?

Jan 11, 2011

I have created an asp.net custom control and now want to pass some values to it from the page which will use the control.Is there any way i can add my own property to the control (like Text property is present for a Label control)?

View 4 Replies

Custom Server Controls :: Cascading DropDownList Custom Control - Design

Jun 14, 2010

I seriously want to learn how to create a custom server control, for that I made a requirement for myself, but lost on how to accomplish it.
Requirement -I want to create a cascading dropdownlist control - which should have following properties -1) ConnectionString - used to get data for the 1st dropdown from database, and also it is used by 2nd DropDown to get data.2) 1stSelectCommand - Used by the 1st DropDown to get data from the database.3) 2ndWhereCommand - used by the 2nd DropDown - uses the selected value from the 1st DropDown in the where clause to get data.
Methods - 1) DropDown1_SelectedIndexChanged()2) DropDown2_SelectedIndexChanged(3) CustomCascading_Changed() - this happens when any of the DropDowns index changed.
PS - This is a random requirement, of course it got nothing to do with any project or real time.I want to learn, so i incorporated basic concepts like Data Access, Custom Methods, Properties etc.PPS - I know how to create basic custom server control, so plz dont forward me links to how to create basic custom server controls. But in case with extrordinary links.

View 6 Replies

Accessing Property Value Of A Custom Control By Another Custom Control In Design-time

Oct 18, 2010

I created an Extender which has a custom property that drills down a list XML elements from an xml file, where users can select xml elements during design-time. This works perfectly fine. However, my code only has a hardcoded xml filename (source of the xml elements list) and I need to change this by maxing the xml file user-specified.

What I did is that I created another control (panel) which has a custom property that when clicked (through the ellipsis), it will allow a developer to select the xml file which is supposed to be the source xml file that the Extenders shall use. The filedialog from custom panel's property works perfectly fine.

However, my problem now is that when I drag-drop my Extender, I cannot find a way to get the property value of the custom Panel Control which contains the xml filename. I tried creating a static variable which I thought the custom controls can share but VS2010 is breaking.

View 4 Replies

Unable To Get Values From Value Property Of HtmlInputHidden

Mar 16, 2010

I have a custom control that inherits from .NET's CompositeControl class. This control overrides the CreateChildControls in order to build its child controls dynamically. I need the page to post back after a couple different javascript events occur on the client side.

In order to accomplish this, I create two hidden controls on the page so I can set their values with javascript, submit the page, and read the values out on server side. Here's is the code I use to create these two hiddens:

[code].....

View 2 Replies

Unable To Get The 'Profile' Property In The Code Behind?

Mar 10, 2010

I have added some profile properties to my web.config:

<profile automaticSaveEnabled ="true">
<properties>
<add name="NumVisits" type="System.Int32"/>
<add name="UserName" type="System.String"/>
<add name="Gender" type="bool"/>
<add name="Birthday" type="System.DateTime"/>
</properties>
</profile>

However when I try to access the property in a code behind it does not exist. The following code does not work (says firstname is not a property):

Profile.Gender And In the Asp.net Configuration 'Profile tab ' Is not showing. I have rebuilt the solution. I am using VB.NET(3.5)

View 1 Replies

Unable To Initialize The Automatic Property In C#

Apr 6, 2010

I have an automatic property

public int GearCount { get; set; }

when i try to initialize it like this-

Tandem t = new Tandem(GearCount = 5);

It gives an error as below

The name 'GearCount' does not exist in the current context

Whats wrong here ? Also if i do normal intantiation it works fine.
Tandem t = new Tandem();

View 3 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 Controls :: Unable To Convert User Control To Custom Control

Oct 27, 2010

I have created a user control and am ready to convert it into a custom control. I am trying to follow:

[URL] the steps mentioned in the link.

I am not seeing Build / Publish Web Site option.

I am using VS 2008. I only see Publish User Control but it doesn't give all the settings mentioned below. When I do publish user control, it just copies the ascx file to the desired location. how can I convert the user control to custom control.

View 2 Replies

Web Forms :: Unable To Change The Selectedindex Property To 0?

Sep 13, 2010

i am unable to change the selectedindex property to 0 it is coming as -1 only and the code wat i am using is

if (lstintellisense.SelectedIndex.ToString() == "-1")
{
lstintellisense.SelectedIndex = 0;
}

after making 0 also its remaining as -1 only and i am getting exception as InvalidArgument=Value of '0' is not valid for 'SelectedIndex'. Parameter name: SelectedIndex

View 7 Replies

Web Forms :: Unable To Set Control's Property After Update / PagePostBack

Sep 22, 2010

I'm trying to programmatically set the property of a control on my Form AFTER I've proccessed an update command using the FormView, but it's not working. In my example below, I have a basic FormView with only a TextBox and Label in its EditItemTemplate. The FormView uses an AccessDataSource. The TextBox is bound to the datasource, but the label is not. What I'm trying to do is update the value in the TextBox (as well as its associated data stored in the database), and then change the Text property of the Label. (*Note: that I using the label purely as an example. The point is I can't see to set any control's property after an update).

I initally thought it had something to do with the "Page.IsPostBack", but even after trying to adjust my code for that, its still not working. I've tried change the Text property during the Page.IsPostBack during Page_Load event. I've tried setting the Label's EnabledViewState property to True and to False. I've tried using the FormView's OnItemUpdating and OnItemUpdated events. I've tried using the DataSource's OnUpdating and OnUpdated events.

View 11 Replies

AJAX :: Modal Popup - Unable To Set Label Text Property

Sep 27, 2010

I have ajax accordion with 6 panes with an user control inside each of it. In the first pane I have a form view user control and have a modalpopup to display error message. The same method is used in all other panes.

On page load I was able to set the label text property and it properly shows in modal popup.

However whenever I do some validation and update label text property, the modal popup shows up but the label text property is not updated. It works in all other panes.

The only difference is the user control in the pane is inside of a update panel. If I remove the update panel every thing works fine. But I need the update panel to avoid full post back.

How do I set the label text property inside of a modal popup.

Sections of code below:

[Code]....

View 1 Replies

MVC :: Unable To Get DataAnnotations Client Validation And Nullable DateTime Property

May 12, 2010

I am having a problem with the Client Validation not firing when I have marked a nullable DateTime field as [Required] and the value of the field is null. (It is actually stopping ALL client validation on the page working - not just the DateTime field).

Interestingly enough, once a post back has been done and the error picked up on the server, the client validation starts working.

Also if you set the date to a none null value (see commented out line in the controller) it will also work

I have replicated this behaviour in a small test project (this is deliberately very Noddy - just enough to replicate the problem)

Am I doing something fundamentally wrong or am I looking at coding some sort of work around here? (I realise that a Required nullable field sounds like a bit of a oxymoron, but I wanted to present the user with a blank field which they must then fill, not one pre-populated with an arbitrary date value)

Model

[Code]....

View (Auto generated)

[Code]....

[Code]....

View 5 Replies

DataSource Controls :: Unable To Alter Connection Timout Property?

Feb 22, 2010

Im using two stored procedures to write and update values in a SQL DB. Im using the SQLDatasource update method. When I run the webpage on my development server everything runs fine. When I try and run the web page on my Live server I get the following error :System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding This always takes 30 seconds to fail - and looking at google it seems that this is a connection timeout error.In my web.config file I have updated the connectionstring line to include a timeout setting :

connectionString="Data Source=myserver;Initial Catalog=ReportServer;Integrated Security=True;Connect
Timeout=10000"

But this hasn't helped at all.

View 3 Replies

Add A Custom Property In A File In .Net ?

Nov 29, 2010

There are some .txt, doc and other extension type of files in a folder now i want to add custom properties on all file how to do it ? there are already some attribute like Location, Size, Size on Disk, created on , modify on so i want to add another property like "version".

View 1 Replies

How To Get Custom Property From Textbox Using Javascript

Mar 26, 2010

I have created a custom text box with property "key"(ASP.NET C#).I want to get the value of this property "key" using java script.How can I do this?

View 2 Replies







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