Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

web user control and setting hidden input variable

Posted on 2006-11-06
2
Medium Priority
?
293 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 2000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
Integration Management Part 2
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

963 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