Solved

web user control and setting hidden input variable

Posted on 2006-11-06
2
280 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
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…

828 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