?
Solved

web user control and setting hidden input variable

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

718 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