I have build a composite control which renders a TextControl or a RADEditor control, dependable of a property a set. Both rendered controls have a Text-property. The problem is that when I change the Textvalue on my webpage (when it is running) it won't set the new Text-value but the old Textvalue instead.
Below the code of my composite-control.
using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Telerik.Web.UI; using System.Web.UI.HtmlControls; using Framework.WebControls; namespace Components.Broadcasting.Controls.....
I'm writing a simple C# Windows Form app, I send it to a website, and on the website there is a Drop Down menu with options. I want to extract those options and add it to my own drop down menu on my app.
I have a drop down list with two options Score and status. On selecting score select score i display a MultihandleSliderExtender to select the score range ex: 10 to 20 and on selecting status i display dropdown list . On displaying one option i make the other as not visible.
Now comes the problem in Firefox (works properly in IE) when i select score and then try to change my option to status it does not allow me to do so i.e the mouse over event on the dropdownlist is not working.
There are 10 options in the list box but I want the user only to select a maximum of 4. If user selects more then 4 then I want to display a message to user that they cannot select more then 4 options.
How can I achieve the above using some custom validator control?
I am trying to included a rating control in a composite control that renders many different type of controls. I render the controls by overriding the rendercontents so that I can control the layout of the controls. When I try to add the rating control to the output i get a Page cannot be null error. Can someone provide me with the proper way to render a rating control from a composite control and be able to control the layout of the child controls.
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 { get { object oObject = ViewState["HeaderControlName"]; return (oObject == null) ? null : (FormView)oObject; } set { ViewState["HeaderControlName"] = value; } } protected override void CreateChildControls( { Controls.Clear(); Button xx = new Button(); Controls.Add(xx); } } 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" /> Webpage.aspx.cs protected void BsCmdTest1_Init(object sender, EventArgs e) { CmdTest1.HeaderControlName = FormView1; }
I have a custom control that renders different controls based on a property value. This all works correctly until i try and add a rating control to the control. When i render both controls in the CreateChildControls the control is rendered properly.
However when i try to add layout by overriding the RenderContents method and rendering controls there, an error is generated Extender controls may not be registered after PreRender.The code shows both methods of creating the controls.
I am learning custom controls and just finished my first one. The problem is that I am struggling to register it in my web config and have the compiler recognize it. Right now this results in a YSOD about the reference to the control.
note: exact error - Error Unknown server tag 'cc:LblTextBox'.
Web Config
//.. //.. <pages> <controls> <add tagPrefix="cc" namespace="Controls.Server"/> </controls> </pages> </system.web> The control code-behind namespace Controls.Server { public class LblTextBox : CompositeControl { //... } } mark-up <%@ Page Language="C#" AutoEventWireup="true" CodeFile="ControlsMain.aspx.cs" Inherits="Pages_ControlsMain" Trace="true" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Controls Area</title> </head> <body> <form id="form1" runat="server"> <div> First attempt at a simple composite control <br /> <cc:LblTextBox ID="ccLblTbHybrid" runat="server" LabelText="Name:" /> </div> </form> </body>
I am creating a composite control that has a textbox and uses a jquery plugin to add a watermark. Lets say I have a basic function that looks like this
$(function () {$('#MyTextBoxID').watermark('Enter your username');});
Can anyone suggest what I need to do to insert the above?
If a composite server control normally encapsulate styling information inside, it is an example of code encapsulation and modularization. However if css properties are included inside the composite control, it is not ideal for code/styling separation and css code re-use principles. Now which consideration should be the main consideration?
I have a Default.aspx program that contains a Treeview with a SiteMapDataSource. I also have a web.sitemap loaded up with urls. When I run the deafult app I get the tree layout that matches the numbers of options but no text on any of the options to click.
I have a composite control that has a couple of private fields that reference values in the cache and these private fields are called during the constructor method. Since a string key is used to identify the value in the cache, I must have a way of storing that string key in such a way that it is available at the time the control is instantiated, and I have to be able to reference it on postbacks without it changing.
In addition, this key is generated the first time the control is loaded, but it should not be changed again after that first time.
How can I accomplish this?
I have already tried saving it to viewstate, but that doesn't work because viewstate is not yet available at the time the control is instantiated.
I have tried using a private field and then checking against Page.IsPostback in the constructor and if it isn't postback, I assign a value to the private field, but on subsequent postbacks it looses it's value, and I can't reassign it in the Page.IsPostBack again because it is an autogenerated GUID.
In our current ASP.Net Webforms application we have several composite/template server controls that only exist for a common look and feel. For example, we have a panel control that has a title, a place for buttons related to the contents of the panel, and of course the contents. How is this best accomplished in MVC? RenderPartial doesn't get done what I need here. Should I still be using the same controls, but just on a view page? These controls don't really do anything on postback, they are only there for a common look and feel.
More Info:
We have a control in Webforms that implements ICompositeControl. We have a few properties on this control like Panel (type Panel), Buttons (again type Panel which would hold buttons) and a property Title of type string. Visually it looks like
I am trying to make a simple composite control - just a label and textbox - but the postback isn't being picked up by the control.I haven't implemented IPostBackDataHandler as according to this its not necessary - the TextBox control should tie in automagically. A composite control that includes a TextBox need not worry about postbacks, as the embedded control will work it out with ASP.NET automatically.
I want to develop composite control where some of the work would be executed on client side. For that I am implementing IScriptControl.
ScriptReference points to a script file with client object.
Let's say I want it to have Listview(html select) control that onselect will run javascript function based on the selected value.
I can't just create the control dynamically is client js, because the control has UI on design mode so I must create the select control on server side (I create it in override void Render)
My problem how and where to assign the onselect event for the selection.
Update: Maybe I should add select's id as property to ScriptControlDescriptor, then in client control retrieve this id and attach the needed handler to the event?
I have got a composite control and i would like to dictate which attribute/property is assigned to the control first from the markup?example in the aspx file:
when the control gets created from the mark-up above, ViewType will be assigned first, Which is what I do not want, I would like RealBase to be assigned first under all circumstances. This control is to be users by other developers so I cannot just switch the order.