Solved

web user control and setting hidden input variable

Posted on 2006-11-06
2
286 Views
Last Modified: 2008-02-01
Hi,

In a web user control, I created a hidden input tag on the .aspx page using javascript and I am trying to set it to the browser type.

However it doesn't seem to work. What is the proper syntax for calling it? document.Forms(0).getelementByID("bt") doesn't work.

Thanks

<script language="javascript">
      var browser_type = (navigator.appName == "Microsoft Internet Explorer") ? "ie" : "oth";
      document.forms(0).getElementById("bt").value = browser_type;
      </script>
<input type="hidden" name="bt" id="bt" value="">

0
Comment
Question by:Gezna
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 33

Accepted Solution

by:
raterus earned 500 total points
ID: 17885248
You _do_ realize you can determine the browser on the server, as the user-agent is sent in the HTTP headers.
http://aspnet.4guysfromrolla.com/articles/120402-1.aspx
0
 
LVL 6

Expert Comment

by:DonKyles
ID: 17886392
This should work for all browsers

<asp:TextBox ID="bt" runat="server" Visible="true" ></asp:TextBox>

In the code file:

 you can put any value into this textbox or you can visible it.

bt.Text = "hello world";
bt.Visible = True;

It would be better if you give more detail why you did it that way.
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question