Web Forms :: Design Time Support For Custom Templated User Control In VS 2008

Sep 22, 2009

I'm running into a problem with design time support for a custom templated control in VS 2008. I am getting the following error: "Type System.Web.UI.UserControl does not have a public property named Header Template" Here is a snippet of the user control code:

[TemplateContainer(typeof(TemplateControl), BindingDirection.TwoWay)] [PersistenceMode(PersistenceMode.InnerDefaultProperty)] [TemplateInstance(TemplateInstance.Single)] [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public ITemplate HeaderTemplate { get { return header; } set { header = value; } }

Here is a snippet of the usage code: My Header Various other developers have run into this problem as well, but I have not found a solution. A possible work around may be that I need to create a server control.


Custom Server Controls :: OnItemCommand Not Firing In Templated User Control?

Aug 11, 2010

I have a templated user control with single instance template attribute. It works great for everything except the following scenario:


The folder selector uses a tree view that allows people to select a folder, its FolderSelected event works perfectly and the file selector updates with the files. The file selector has a repeater that lists the files in the selected directory. It has a linkbutton for each of the files so that the user can select a file. The problem is that the ItemCommand event of the repeater doesn't fire when the file name is clicked on. The page performs the async postback like it should, but in debug, the method to handle the itemcommand event is never hit. On the same user control to select files there is a button that the user can add files to the folder. When it is clicked, the event DOES fire and the file is added and the control refreshes in the update panel, everything perfect. It seems that because the linkbutton is already in a templated control (which is in a user control, in a templated control), the event isn't firing correctly. I am confused as to why this should be a problem, especially since all the other events (even the custom ones) fire as long as they aren't in another templated control. Since the code is complicated, I didn't want to post it all here.

View 6 Replies View Related

Custom Server Controls :: Custom Control Design Time SiteMap Provider Error?

May 13, 2010

I was referred here by MSDN forums hope this is the right place - I have a custom control (:WebControl) that renders web.sitemap in a specific way. While it runs error free and produces the expected result, at Design-Time it complains


and have tried the SiteMapDataProvider Tag with and without the SiteMapProvider
attribute.Does anybody have (a) any experience with this, or (b) any suggestions as to how to track down the problem?

View 3 Replies View Related

Custom Server Controls :: Custom Control To Load Types At Design Time From The Assembly Hosting?

Sep 12, 2009

I have a custom server control for asp.net. One of the properties available to it is a generic object. That generic object has custom attributes that are read and used to customize the rendering of the control.At run time, this is no problem, since all I need to do is find all the attributes on the instance that gets passed into the control.However, just as the "DataSource" member of controls can call up a list of object types at design time, I would like to be able to bring up a list of types in the host assembly. There is no need for actual instances, since I'm rendering based on attributes.This is an example property from the host control:


What I want to have happen is to have TheObjectConverter be able to load the assembly of the host page for the control.None of the following seem to work


I even a full recursion against .GetReferencedAssemblies(), with no luck. It seems I am unable to load the assembly of the control's host at design time. Is that correct, or is there a way to do this?

View 4 Replies View Related

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 View Related

Custom Server Controls :: Resize User At Design Time

Jul 2, 2009

I have developed a usercontrol with two panels each holding some controls... Now wgen i use this usercontrol ina form and if i have to adjust the size of the user control it is not possible for me. I meanfor example when i want to make my user control to reduce the size i selected my user control and by using mouse in normal way i tried to reduce the size then i came to know that the controls that r present in thaose panels are not adjusting and so the controls present at the corners are losting.. the whole panel is not resucing.

View 2 Replies View Related

Asp.Net Custom Control Design Time?

Feb 9, 2010

I'm developing a set of custom controls, one of them are the "parent", any others must be added inside an ITemplate property of this parent. But in the page, at design time, I can see, by intellisense, the other controls at page level, and I can theorically add them everywhere. I want to emulate the behaviour of the asp:Table and the asp:TableRow, you can't directly add an asp.

View 2 Replies View Related

Web Forms :: User Control Can't View In Design Time

Mar 30, 2010

I have the user control and web page. When I place user control in the web page and in design time, it cannot view and error is "System.Web.UI.UserControl does not have a public property named 'ContentTemplate". It seems not related of error message.

View 5 Replies View Related

Web Forms :: Assignment Of FormView Control In Design-time To User Defined Composite Control

Feb 1, 2011

i create a composite control as can be seen in code below, and add this control to webform, assign FormView1 to the HeaderControlName property, Run the page, the system will generate parse error message :
Cannot create an object of type 'System.Web.UI.WebControls.FormView' from its string representation 'FormView1' for the 'HeaderControlName' property. However, if i don't assign FormView1 in design screen and manually (through coding) assign FormView1 to the custom control on init, it works as expected.

custom control
public class CmdTest : CompositeControl
public virtual FormView HeaderControlName
object oObject = ViewState["HeaderControlName"];
return (oObject == null) ? null : (FormView)oObject;
ViewState["HeaderControlName"] = value;
protected override void CreateChildControls(
Button xx = new Button();
webpage.aspx (assign FormView1 in design time, it will generate error)
<Utils:CmdTest ID="CmdTest1" runat="server" HeaderControlName="FormView1" />
webpage.aspx (didn't assign FormView1 in ASPX, but assign it on Init Code, it works)
<Utils:CmdTest ID="CmdTest1" runat="server" oninit="CmdTest1_Init" />
protected void BsCmdTest1_Init(object sender, EventArgs e)
CmdTest1.HeaderControlName = FormView1;

View 2 Replies View Related

Custom Server Controls :: Use Extended Control And Still Have Design Time List Items?

Aug 17, 2009

I created my own user control by extending a drop down list to give it some extra attributes. However, when I do this, I lose the ability to add design time list items. Example, lets say that I have a DropDownList below which works fine. If I change the control from the DropDownList to my extended DropDownList <uc:ucDropDownList e.g., it no longer recognizes the design time list items. Is there a way to use my extended control and still have design time list items?


View 19 Replies View Related

Custom Server Controls :: Composite Control - Design Time Gridview Is Not Displaying?

Apr 19, 2010

I have use composite custome control its contain button and textbox and gridveiw

but design time gridview is not display .

View 1 Replies View Related

Asp Net Web User Control Rendering In Design Time?

Sep 29, 2010

I render some markup dynamically in a Web User Control, can I get that out in design mode, and not only runtime?

public override void RenderControl(HtmlTextWriter writer)
if (this.DesignMode)
writer.Write("<p>In design mode</p>");

... nothing happens when I check the design view of the control. Not if I remove the if (this.DesignMode)-condition either.

View 2 Replies View Related

Web Forms :: How To Control Custom Templated Databound

Nov 11, 2010

I am fairly new to asp.net programming. I found this custom control that uses ajax to update the contents of the control and it is working perfectly. However, I need to access some of the asp.net labels and images in the databound event so I can set their values/properties appropriately, and am not sure how to go about adding additional code or accessing these in my custom control (I have been googling endlessly with no results). My code for the custom control is below.

Imports System
Imports System.Text
Imports System.IO
Imports System.Collections
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports Microsoft.VisualBasic
Namespace myControls
Public Class AjaxDivView
Inherits CompositeDataBoundControl
Implements ICallbackEventHandler
Private _itemTemplate As ITemplate
''' <summary>
''' The ItemTemplate is used to format each item from the data source.
''' </summary>
<TemplateContainer(GetType(DivViewItem))> _
<PersistenceMode(PersistenceMode.InnerProperty)> _
Public Property ItemTemplate() As ITemplate
Return _itemTemplate
End Get
Set(ByVal value As ITemplate)
_itemTemplate = value
End Set
End Property
''' <summary>
''' Register Javascript
''' </summary>
Protected Overrides Sub OnPreRender(ByVal e As System.EventArgs)
'Register Refresh Function
Dim eRef As String = Page.ClientScript.GetCallbackEventReference(Me, Nothing, "AjaxDivView_Result", "'" & Me.ClientID & "'", "AjaxDivView_Error", False)
Dim refreshFunc As String = "function AjaxDivView_Refresh() {" & eRef & "}"
Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), Me.UniqueID, refreshFunc, True)
End Sub
''' <summary>
''' Iterate through the data items and instantiate each data item in a template.
''' </summary>
Protected Overloads Overrides Function CreateChildControls(ByVal dataSource As System.Collections.IEnumerable, ByVal dataBinding As Boolean) As Integer
Dim counter As Integer = 0
For Each dataItem As Object In dataSource
Dim contentItem As New DivViewItem(dataItem, counter)
counter = counter + 1
Return counter
End Function
''' <summary>
''' Render this control's contents in a Ul tag
''' </summary>
Protected Overrides ReadOnly Property TagKey() As System.Web.UI.HtmlTextWriterTag
Return HtmlTextWriterTag.Div
End Get
End Property
''' <summary>
''' Render my contents to a string and send the result back to the client
''' </summary>
Public Function GetCallbackResult() As String Implements System.Web.UI.ICallbackEventHandler.GetCallbackResult
Dim builder As New StringBuilder()
Dim sWriter As New StringWriter(builder)
Dim hWriter As New HtmlTextWriter(sWriter)
Return builder.ToString()
End Function
''' <summary>
''' Whenever I get called through AJAX, rebind my data.
''' </summary>
Public Sub RaiseCallbackEvent(ByVal eventArgument As String) Implements System.Web.UI.ICallbackEventHandler.RaiseCallbackEvent
End Sub
Public Class DivViewItem
Inherits WebControl
Implements IDataItemContainer
Private _dataItem As Object
Private _index As Integer
Public ReadOnly Property DataItem() As Object Implements System.Web.UI.IDataItemContainer.DataItem
Return _dataItem
End Get
End Property
Public ReadOnly Property DataItemIndex() As Integer Implements System.Web.UI.IDataItemContainer.DataItemIndex
Return _index
End Get
End Property
Public ReadOnly Property DisplayIndex() As Integer Implements System.Web.UI.IDataItemContainer.DisplayIndex
Return _index
End Get
End Property
Protected Overrides ReadOnly Property TagKey() As System.Web.UI.HtmlTextWriterTag
Return HtmlTextWriterTag.Div
End Get
End Property
Public Sub New(ByVal dataItem As Object, ByVal index As Integer)
_dataItem = dataItem
_index = index
End Sub
End Class
End Class
End Namespace

View 5 Replies View Related

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:


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:


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 View Related

Web Forms :: Access Controls In Templated User Control?

Dec 20, 2010

I am trying to access a control from the code behind in a tmeplated user control and and keep getting an object reference exception.

Is it possible to access these controls. I have tried the find control and just referencing the object i.e. this.someID, non of which worked.

Here is my templated control:


Here is the template ascx code:


Here is the test user control that is using the template:


Here is the codebehind for the test user control:


I have also tried this which throws the same error:

Label label = (Label)this.Page.FindControl( "DateTimeLabel2" );
label.Text = DateTime.Today.ToString();

View 2 Replies View Related

Web Forms :: Access A Control In Templated User Control?

Apr 15, 2010

I want to access a label in templated user control.

I find this code in internet, but it doesn't work.

Error:Object reference not set to an instance of an object.

public static Control FindControl(Control parent, string id)
Control recurse;
if (parent.ID == id)


View 4 Replies View Related

Web Forms :: Access Controls From Inside Of Templated User Control?

Feb 8, 2011

I'm working on a user control that renders couple nested divs (a rounded corner box to be frank). This is a templated user control, which means that user can put any control he wants into the header, body or footer of this box. Everything is working fine, except the fact that server-side controls can't be retrived from my box. Take a look at this code:


Now codebehind of that control:


I have cut out all the unimportant stuff.Now when I use this control:


I want to access controls in page codebehind file (on Page Load): LiteralNewses.Text="";
but compiler returns an error that LiteralNewses doesn't exist. Also FindControl method can't find this literal.Any tips on what's wrong with this code? According to MSDN, setting TemplateInstance to Single ensures that controls from template will be accessible but not in my case...

View 1 Replies View Related

C# - Getting Eval To Work In A Databound, Templated Custom Control?

Sep 29, 2010


I'm putting together a templated, databound control. Presently it works with the following syntax...
<cc:ItemChooserControl ID="ItemChooser" runat="server">
<h4><%# DataBinder.Eval(Container.DataItem, "DisplayName") %></h4>


What I would like though is that the shorter, simpler Eval would work instead.
<h4><%# Eval("DisplayName") %></h4>
What I get however when using straight Eval is an error:
Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.


I'm databinding to a custom HtmlTableCell...
public class TitleTemplateTableCell: HtmlTableCell, INamingContainer
private object m_DataItem;
public virtual object DataItem
get { return m_DataItem; }
set { m_DataItem = value; }

With the following custom DataBind (non-related code removed)...

foreach (object dataItem in dataSource) {
TitleTemplateTableCell title = new TitleTemplateTableCell();
TitleTemplate.InstantiateIn(title); // TitleTemplate is the template property
title.DataItem = dataItem;

View 1 Replies View Related

Custom Templated Control - To Modify Where Databound Data Is Output To?

Aug 31, 2010

Basically, I have a custom templated control with a custom data container class. When a developer adds an instance of my control to a page, they can define the controls in the LayoutTemplate however they like, as follows:

<ml:MyControl id="MyControl1" runat="server">

I would like my control to automatically move the "ml_errormessage" (databound content from Container.ErrorMessage - hard coded token in the property) to be a class of its containing element to make it easier for jQuery to use a selector to find the element and dynamically insert the error message client side. More importantly, I would like it moved out of the way so the class name doesn't get replaced by the content and jQuery can find it as many times as it needs to during the page lifecycle. In other words, I would like the output to look like this without the developer changing the input template or resort to using custom controls in the template:

<span id="MyControl1"><span>
<span class="ml_errormessage"></span>

I would like to move the value using the controls collection rather than resorting to string parsing of the output, if possible. However, when I interrogate the collection in an override of OnPreRender, the control in the template looks like this in the debugger:

System.Web.UI.DataBoundLiteralControl: {System.Web.UI.DataBoundLiteralControl} [code]...

As you can see the "ml_errormessage" value is nowhere to be found. Upon analysis of the DataBind event of the Control class using Reflector, I see that it delegates the binding behavior to each control. In other words, each control handles its own databinding. However, since I have no way of knowing in advance what control types will be in the template, how can this change be done?

Note: an acceptable alternative would be to add a new HtmlGenericControl (span) in the exact spot where the "ml_errormessage" is and add it as a class to this new control.On a side note, is there an easy way to get the control's output to indent for easy reading during debugging?

View 1 Replies View Related

How To Create Custom Multi-templated Tree Databound Control

Apr 5, 2010

I dont want to use asp.net's TreeView control. I want to create a custom template databound control with multi template support like -


My data is like -

class Employee
string EmployeeName
List<Employee> Employees

Does anyone know how to accomplish it?

View 1 Replies View Related

How To Build A GridView Like DataBound Templated Custom Server Control

Apr 13, 2010

I am trying to develop a very simple templated custom server control that resembles GridView. Basically, I want the control to be added in the .aspx page like this:


I know that what I want to achieve is pointless and that I can use DataGrid to achieve it, but I am giving this very simple example because if I know how to do this I would be able to develop the control that I need.

View 1 Replies View Related

Custom Server Controls :: Unable To Type In Templated Control?

Oct 11, 2009

I have created a templated ASP.Net Control but I cant type in my templates and If I use code to put some text in a template the designer will remove it.

View 4 Replies View Related

Custom Server Controls :: How To Create Templated Control Without Naming Container

Dec 9, 2009

Due to my previous investigation i found, what ASP.NET allow to create only two type of control organization.

The first - is simple children controls, it lay in NamingContainer same as parent controls's. Example is MultiView.

The second - is templated controls, it lay in separete NamingContainer of it's holder. Example is Wizard.

So the problem: first type of organization does not allow customization, but second does not allow external databinding.

The target is to create control like Wizard, but without NamingContainer.

View 2 Replies View Related

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.


View 4 Replies View Related

Web Forms :: User Controls Not Displaying On Form At Design Time?

Jun 21, 2010

None of my user controls display on a web form at design time. At runtime they work fine and at design time to design the user controls themselve is fine.

Is there a setting that is telling the controls not to render at design time?

View 3 Replies View Related

Custom Server Controls :: Design Time Markup End With />?

May 7, 2010

I'm developing a custom server control and want it to end with /> rather than with </cc1:CustCtrl>. I've tried changing the ToolboxData but it didn't really do it (I can see it initially appears like that but instantly changes to the standard <cc1:CustCtrl blah blah></cc1:CustCtrl>. When i drag a button from the toolbox to the forms markup it uses the <asp:Button blah blah /> markup, how can I emulate this?

View 3 Replies View Related

Custom Server Controls :: How To Add Child Container Control With Child Controls In Design Time

Nov 27, 2009

I have created a custom web control, for the design time requirement, I create a designer inherits from ContainerControlDesigner so that my control just like a container

I want to add child control to my custom control in design time, so I created a DesignerActionMethodItem in my custom action list, and the code for add child control is :


This code works well. But what I want is before adding some textbox, add a panel as a container . So I changed the code like this:


When running, I got an ArgumentException said that I can not add a control with child controls. So I changed my code like this:


But unfortunately, I still got an ArgumentException says "Value does not fall within the expected range". So what shall I do?

View 2 Replies View Related

Custom Server Controls :: Adding Template In Design Time?

Mar 13, 2010

i create a custom control which can hold some templates, such as Header, Body Footer, etc.


i tried to use smarttags to allow the user to edit each of the templates, which worked pretty well. what i could not get working was to add a template if it has not been in the control. eg. add a header-template to the control above. i tried using the RootDesigner.AddControlToDocument() function of my controldesigner. but this function gives me an error, telling me the control i'm going to add the template (i used a new HtmlGenericControl("HeaderTemplate") as new Control) to is not valid. (i can't give the exact error message, cause i use a german version of visual studio 2008) i've been searching the web for nearly half a day now, but i did'nt find a working solution for my problem.

View 2 Replies View Related

Custom Server Controls :: View Changes In Webusercontrol During Design Time?

Jul 31, 2010

I have created an advanced label control using web user control to cater some advanced options needed for my application. The control is working fine but there is one hitch bothering me. In normal label control when we change text or color, we can see effects during design time also but this is not functional with web user control. I mean when i change TEXT property of my label inside user control, the effect is visible on runtime not design time.

Is there any way to see effect of property changes during design time??

View 1 Replies View Related

Custom Server Controls :: UpdatePanel Not A Container In Design Time?

Nov 3, 2010

I have a custom Panel with attribute Designer(typeof(xxxMainPanelEditor), typeof(System.Web.UI.Design.WebControls.PanelContainerDesigner)). The child controls of this custom Panel Control at design time can see all the exposed properties that I want to share from the Parent (no problem here).

However, if I place controls on an UpdatePanel, these child controls cannot see the parent container but instead, it immediately sees the form/page or DesignerHost. The problem is the same even if I put Panel on the UpdatePanel and vise versa.

Is there a way to manage controls inside an update panel? For me, this behavior is like saying that UpdatePanel is not container based during design time?

View 11 Replies View Related

Custom Server Controls :: Hide Items In Design Time?

May 23, 2009

I'm working on a composite control, I added the child controls sucessfully, it's just a button and a textbox.I added more items in Render function, it's HTML table with some attributes, but when I add the control to my ASP.net page I found all the itmes appear in the page, while I want the button and Textbox to be appeared in the page and exclude the table to be appeared in the run time only.

View 3 Replies View Related

C# - Design A Database For Templated Logging Purposes?

Jan 30, 2010

In my web application I want to log certain user interactions etc, like "User ABC joined Group XYZ" Therefore I want to set up a logging mechanism that logs into a Mssql database. I'm now trying to find a good database design to achieve flexibility.

First of all, I don't want to log strings like "User ABC joined Group XYZ". I'd like to separate the content "ABC" and "XYZ" from the template. So I'm looking for a templated logging database.

Something like this:
table: UserLog

IDLog int primary key [code]......

I think this database structure would give me enough flexibility to add/remove/edit specific log types (like 'User ABC did something else'). For example I might want to add some information to a specific log entry for future entries. Therefore I create a new UserLogTemplate that references the same UserLogType. That is how I would achieve downward compatibility.

Is that a database design that will work?

View 2 Replies View Related

Custom Server Controls :: Design Time Only Properties Doesn't Persist?

Jul 20, 2009

Was wondering if I could seek out any of you experts out there on this issue I am facing: I am currently developing a custom control - let's refer to it as MyInfoControl (inherited from WebControl) and its accompanying custom control designer MyInfoControlDesigner (inherited from ControlDesigner). In the course of using MyInfoControl, a developer may need to get/set a design time only property (say SiteUrl), so that the subsequent custom designer capability (e.g. custom UITypeEditor) would run properly. MyInfoControl does not need the property SiteUrl at runtime. Hence the logical thing to do (correct me if I am wrong) is to declare the property in the custom control designer override the PreFilterProperties of the custom control designer to add the property (from the custom control designer) to MyInfoControl being designed. All done during design time. The SiteUrl property is applied with the attribute [DesignOnly(true)] and [PersistenceMode(PersistenceMode.Attribute)] I am able to see and edit the design time only property from the designer (in this case Visual Studio 2005 and Visual Studio 2008). The problem is that I am not able to persist the value that I have edited in the design time SiteUrl property.Upon toggling to HTML view, or closing then reopening a project, the value provided in the property will revert to the default value, as if nothing happened before.

Q1 - I noticed that the HTML of MyInfoControl does not have the property SiteUrl serialized into it (as an attribute), each time the property is edited. Is this the cause of the unpersisted state? If yes, what can I do to get around this?

Q2 - If my understanding of the persistency is not due to serialization as mentioned in Q1, what would be a proper way to persist the value (and thereby the state of the control?)

Have looked up on every article possibly related to design time support on the Internet but could not yield anything useful (as most of them are referring to design time support for Windows control, not web controls). I am not able to provide any code samples as of current but would be glad to do so the soonest I can get my hands on them

View 7 Replies View Related

Custom Server Controls :: Custom Control Design View Error

Aug 13, 2010

I have created a custom control from scratch and it works fine as in you can build the project that uses it and it works fine at runtime. Problem is when you go to design view the control shows an error in the place of where the control should be rendered.

Error: '<SomeValue>' Could not be set to '<SomeProperty>'

This shows up on all my custom set properties. These properties are created as basic as possible. I can give the properties values in Source view and run the app just fine. I can even add a Onclick event. If I don't set any custom properties the control will render fine in Design view. It's only when I set a value to a custom property.

Property Code Example:


I've even removed the Category and Description tags with no difference.

I don't know if what I said makes sens, but I hope it does.

View 3 Replies View Related

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 View Related

Web Forms :: Control Property Value Persistence In Design Time?

Oct 8, 2009

I have created a custom control in which i have a property of an object type.In design time it works fine if i drag and drop the control from toolbox and set the property. But if i copy/cut the control after setting the value for my custom property and paste it, the custom property value is missing. The control re intializes i think. I failed in trying out below options for the properties.

1. ViewState
2. [PersistenceMode(PersistenceMode.Attribute]
3. [PersistenceMode(PersistenceMode.InnerProperty)]

Is there any ways in which i can persist my values in design time? Now am trying to write my own copy and paste functionality where i will save the property values in a object in clipboard and reassign it during the paste operation.

View 1 Replies View Related

Custom Server Controls :: Custom Control Image Not Rendering In Visual Studio Design Mode

Apr 25, 2010

I have a simple HttpHandler that generates a dynamic image based on query string parameters and a custom web control that renders an image tag pointing to the handler as its 'src' attribute. All works fine when run in the web server, but at design timethe control displays as the "missing image" icon (red x in a box). The handler is registered in the web.config with a ".ashx" extension. The RenderContents method in the control looks like this:

output.AddAttribute("src", ResolveUrl(string.Format("~/Sparklines.SparkHandler.ashx?stype=pm&w={0}&h={1}&sv={2}&ev={3}&cv={4}&sc={5}&ec={6}&mc={7}&gs={8}",
Width.IsEmpty ? 100 : Width.Value,
Height.IsEmpty ? 15 : Height.Value,
caleStart, ScaleEnd, CurrentValue,
ColorUtils.ColorString(StartColor, true),

View 5 Replies View Related

Custom Server Controls :: Initial Value For Unique Guid Property At Design Time?

Nov 6, 2009

I have Custom Web Control with ViewGuid property:


I need replace Guid.Empty initial property to some Guid.NewGuid() unique value which changes initial value of ViewGuid ones (if ViewGuid is not defined) and creates "ViewGuid" attribute at ASPX file.

Changing code to:


creates new Guid value at Property Editor but does not save it to ASPX file, so we have new Guid at PropertyEditor but still have nothing at ViewGuid attribute (expecting <cc1:MyControl Id="Somthing" ViewGuid="[generated Guid]" />) and bug is when you reload page we have new Guid, (not first one, when we just created control) So question is how to save initially generated value of ViewGuid at design-time | solve the problem of generating new Guid at control creating and make this value serializable at ASPX file.

View 1 Replies View Related

Forms Data Controls :: Bind() Inside Templated User Control Inside InsertItemTemplate Does Not Bubble Values?

Nov 10, 2010

I have a ObjectDataSource and a ListView referencing it.

I have created a Templated User Control (see:
http://msdn.microsoft.com/en-us/library/36574bf6.aspx) and placed it in the ListView's InsertItemTemplate
It has one template <ContentTemplate>. Inside that template, I've defined a couple of server controls with their properties = '<%# Bind("colName") #>'.

See below:


View 8 Replies View Related

Add Required Field Support To Custom Web Control?

Mar 18, 2010

How to add required field support to custom web control? I can't see any doc on that?

View 2 Replies View Related

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