473,756 Members | 3,541 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

setting the Text Property of WebControl if possible

I have a function that has an Argument of type
System.Web.UI.W ebControls.WebC ontrol. I want to set the text-property
of that control. Of course it doesnt work if I cast that control to
(WebControl), because WebControl doesnt have a property Text.
Most Controls that inherit WebControl have text so I guess there must
be an common Interface implemented, but cant figure out what it is.
Goal would be something like:

private function translateCntrl( WebControl cntrl){
(ImaginaryContr olTextType)cntr l.Text = translateString ( cntrl.Text);
}

at the momemt i have tons of functions like

private function translateCntrl( Label cntrl){
(Label)cntrl.Te xt = translateString ( cntrl.Text);
}
private function translateCntrl( Button cntrl){
(Button)cntrl.T ext = translateString ( cntrl.Text);
}
Nov 17 '05 #1
0 1308

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
18414
by: Dixie | last post by:
Can I set the Format property in a date/time field in code? Can I set the Input Mask in a date/time field in code? Can I set the Format of a Yes/No field to Checkbox in code? I am working on a remote update of tables and fields and can't find enough information on these things. Also, how do you index a field in code?
3
1632
by: Janaka | last post by:
I've seen and used some samples where you can set the onclick attrubute to a Button control to get it to do some javascript a la : btnUse.Attributes = "DoSomeJS()"; However when i try and get this to work on certain controls such as the ListItem in a RadioButtonList it just doesn't do anything? Does this attributes property only render for certain controls?
2
997
by: Frédéric Mayot | last post by:
Hi, I have a strange behavior with a webcontrol. It seems that under some conditions, it's not possible to assign a value to a property. theControl is a ListBox theControl.DataSource = someTable theControl.SelectedValue = "1" ' this value belongs to someTable theControl.DataBind()
3
2737
by: Earl Teigrob | last post by:
I have a class that has some fields and properties that I want to serialize. However, one of the fields is of type System.Web.UI.Webcontrols.Webcontrol and it will not serialize so I want to mark it as "NonSerialized". However, this property is not allowed on a property of this type. How can I designate this property so that I can serialize the rest of the call without serializing this property??? Thanks! Property myControl() As...
3
4316
by: Shimon Sim | last post by:
I have control. One of the properties is implemented as StringCollection. I didn't use any Editor attribute for it. During Design time system shows dialog similar to Items in DropDownList but Add button throws an error "Constructor on type System.String not found.". I may understand this message - there are too many contractor and non of them takes string. But how can I fix the problem or may be use the editor similar to Font.Names...
7
3421
by: n33470 | last post by:
We're in the process of migrating our projects to use VS2005 from VS2003. We have a web page that uses the XML WebControl (System.Web.UI.WebControls.Xml) to perform an XSLT tranformation by using the property "Transform" of the webcontrol. Here is a sample: xmlMessage.Transform = _app.Cache.UserMessagesXsltUser; 'xmlMessage' is the XML Web Control, and '_app.Cache.UserMessagesXsltUser' is the transformation to apply.
1
1347
by: shapper | last post by:
Hello, I have a class where I created various controls. One of the controls have a property which is a generic list of WebControl. Then in web site page I have something like: Dim a As New MyNamespace.ListItem a.WebControls.Add(tbName) a.WebControls.Add(lLabel)
18
2189
by: Academia | last post by:
I let the use modify the text of a combobox and then I replace the selected item with the new text (in Keyup event). But if he sets the Text property to an empty string ("") that sets the SelectedIndex to -1. Do you have any suggestion for getting around this problem?
4
1840
by: Jeff | last post by:
hi asp.net 2.0 I have created a custom web control, here is it's header: <%@ Control Language="C#" AutoEventWireup="true" CodeFile="EditUserBox.ascx.cs" Inherits="Controls_EditUserBox" %> In another custom web user control, I use this web control: <%@ Register Src="~/Controls/EditUserBox.ascx" TagName="Eub" TagPrefix="mb"
0
9431
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9255
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9844
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9819
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9689
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7226
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6514
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5289
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3326
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.