473,386 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Attributes.Add to textbox

Hi,

I have a datalist with a textbox control used for entering the qty for a
products, when I click it I would like the qty to clear. I added the
following in the ItemCreated sub of the datalist ;

Dim tmpTextBox As TextBox
tmpTextBox = CType(e.Item.FindControl("txtQty"), TextBox)
tmpTextBox.Attributes.Add("onfocus", "this.value='';")
This works fine in firefox , but not with internet explorer... is there any
reason why ?

Thanks

Neil
Nov 16 '07 #1
1 2422
Howdy,

Could you please paste aspx code as well. Are you using validation controls
by any chance? I checked the code and it should work in both browsers.

Regads
--
Milosz
"Neil Steventon" wrote:
Hi,

I have a datalist with a textbox control used for entering the qty for a
products, when I click it I would like the qty to clear. I added the
following in the ItemCreated sub of the datalist ;

Dim tmpTextBox As TextBox
tmpTextBox = CType(e.Item.FindControl("txtQty"), TextBox)
tmpTextBox.Attributes.Add("onfocus", "this.value='';")
This works fine in firefox , but not with internet explorer... is there any
reason why ?

Thanks

Neil
Nov 17 '07 #2

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

Similar topics

4
by: Tom Vergote | last post by:
Hi all, I have this page with quite a few textboxes which require viewstate ON. However, i execute some Control.Addatributes on them so the take very much viewstate space (three times a normal...
0
by: Paul Rees | last post by:
I am wondering if anyone has encountered a similar problem to the one that I am having. I have an ASP.NET page which has a table and a dropdownlist that was added at design time. The majority of...
5
by: Steven Berkovitz | last post by:
Hi there, I am having a problem where if i add an attribute to a control at runtime the rendered attribute is HTML encoded. For example, on a textbox: textBox.Attributes = "if(x && y)...
1
by: Sanjay Pais | last post by:
I built a custom control for all the basic web.ui.controls like textbox, label, checkbox etc etc. I added my custom attribute called ApplySecurity to the html in the page. However, when I cycle...
3
by: | last post by:
For a given web form, I want to know what the +simplest+ way to add an attribute to all of a particular control type on that page. For example, I might want to add an onClick attribute to all...
2
by: Chrysan | last post by:
I have a popup window, which consists of a TextBox(txtConnectionString) and a Button(btnOK). And, I would to pass the TextBox.Text to a javascript function, when Button is clicked. I write the...
0
by: Jeff User | last post by:
I have my datagrid running pretty much with a EditCommandColumn and some TemplateColumn columns. There are two types of appearance changes I would like to make programatically from my C# code...
11
by: Nathan Sokalski | last post by:
I add several JavaScript events (onchange, onkeypress, etc.) to Controls using the Add method of the Attributes collection. However, if the JavaScript code contains certain characters, such as & or...
1
by: Big George | last post by:
Hello, Controls on webpage: - Datagrid - TextBox Datagrid has Delete button: <asp:TemplateColumn HeaderText="Borrar"> <HeaderStyle Width="10%"></HeaderStyle>
1
by: pcefalu | last post by:
I am having problems modifying textbox attributes (ForeColor, BackColor, Fonts, etc) through the control properties in MS Studio 2005. I created a WebApp Client and dropped a couple of textbox and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.