Web Forms :: Trying To Reproduce GridView.Columns Property In Custom Control?
Mar 9, 2010
I'm working on an ASP.NET 3.5 project that requires me to create several custom navigation server-side controls that can be customized at design time by non-ASP.NET website developers through a simple text editor. All but one were relatively easy to create, but the last one is stumping me. I've looked online and can't find any examples anyplace that come close to what I'm trying to do.The last control needs to give the site developers the ability to manually define the number of nodes that are displayed within the control when it's rendered on a page, and I want to reproduce the design time/runtime functionality of the GridView's "Columns" property. In the Columns collection the site developer at design time can manually specify the look/feel of each column within the ASPX designer. I want to give my site developers the same design-time flexibility so they can add/remove nodes at their whim and not bug me to do it for them.
an anyone point me to any examples of how to create a collection custom child controls that are associated with a custom server side control?
i have created a new user control who contains a gridview so, my prolem now is that i want show all the property of the gridview included in the control, but i want not write like this:"Usercontrol1.GridView1.Datasource=...." but i want write "Usercontrol1.DataSource=..." and this also for other controls how can i do this?
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.
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 .
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 .
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.
We know that using something like Bind("CustomerName") can be used in the Text property of a label control inside a gridview, where CustomerName is a property of the object whose collection is bound to the gridview. If that property is of a complex type (object of another class), how do we use a property of that inline object as a binding for the gridview column?
I'm trying to do something which to me seems like it should be simple, yet I cannot think of a simple way to do it.
I have a built custom control, that has a property I want to change based on a user's interaction with a second custom control. This second control will be a table of data, with an 'edit' link in the last column. I would like the control, when the edit link is pressed, to pass an ID and trigger some event so that I can assign this ID to the first control. My initial technique for building this (second) control was to create some code which will iteratively create some html based on a dynamic range of data selected by the user. I know that I could create some sort of link with a value in the query string, but I would like to implement AJAX and was hoping that I could enable this communication without changing the URL.
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)?
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.
I customized a button from System.Web.UI.WebControls.Button (it is a Custom Control, NOT an User Control, no ascx file)the intention is to adding a OrderID property to the button, that can be bound to a datasource field.
Here is how this control is used in a aspx page:
[Code]....
Here is my definition of the MYButton class, it saved in a .vb file and placed in App_Code folder
[Code]....
Here is the code trying to use the OrderID in btnSave_Click()
[Code]....
The problem is OrderID is always returned as 0.
When first time page is loaded, and gridview is bind to a data source, I step through the code, and the OrderID property are set correctly, but after the postback caused by the button, the OrderID value has lost.
I created a simple gridview user control with a custom property ProfileType which should load different records depending on the ProfileType value when attaching to a web page.
This is my web page:
[code]....
how I can expose user control custom property at its code-behind file.
A common problem in repeater controls where you want to display data for update (like a list of user phone numbers that can be updated and submitted back to the database) is where to store the database unique row identifier. So, I created a custom Textbox control that I've added a Data property to. I populate this data property with the unique row id. The problem is that when I post back the list and go through the repeater items the control's data property is null. The custom control looks like this:
[Code]....
The tag in the repeater looks like this:
[Code]....
I have a custom checkbox with the same data property and it works fine. I actually put in the same repeater with the textbox control and the checkbox control have the row id on postback but the textbox did not. Is there some limitation on the textbox control that might be causing this.
I am developing one custom control. I dont want default web control property should be in my custom control.For example.[Code]....
When you put this control in the page, you will see default web control property such as Font,Border,Width,Height.... I want to show only those properties that I define in my class.Suppose, I have three property defined in class then only three properties will be visible for control, other default web control proeprty should be hide or invisible.
I have created a user custom control, and what I would like to do is to pass it the text value from a label where I can carry out some other processing.
I have a custom user control UserProfileLink on which I have two basic string properties, UID and UserFullName which I would like to use in a template column in a DataGrid like this:
I get an error saying "The server tag is not well formed" which leads me to believe this type of binding isn't possible. Is there a way to do this, or is it impossible?
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.
I am trying to set the width property of a custom control validator but it is not happening at all. The width of the validator control popup is constantly 100% width (the width="200px" below has NO effect at all)
I'm writing ASP.NET custom control, and I want it to have a few properties which should be visible only from code behind during run-time - I mean, these properties should not be visible both in a designer and in a aspx code of page containing this control. I've tried to use following attributes:
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Browsable(false)] public List<Item> SomeData { ... }
but unfortunately this property is still visible in an Intellisense combobox when editing aspx page. Is it possible to hide this property everywhere besides server-side code ?
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.