Solved

web user control and setting hidden input variable

Posted on 2006-11-06
2
277 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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
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…
This video discusses moving either the default database or any database to a new volume.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

743 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now