javascript and getting values from controls...

hi.

i have a problem thats driving me nuts. i get some data from a dataset. then i send the data to a label, writing it out from codebehind to a number of radio buttons.

then when trying to get the data and pass it to a hidden textbox nothing happends, i get an error saying more or less that my textbox is empty.

now ive been at this sucker for days and i just dont know.

the code has worked before, but in a page. now im trying to use it in a usercontrol and get this error.

here is some code:

the loop in with i write the data out form the dataset to radiobuttons: (tempset is the dataset)

 

If tempset.Tables.Count > 1 Then

   For Each row In tempset.Tables("Products").Rows

      idnr += 1

      With carlist

      . Text += "<table width=""100%""><tr><td class=""normaltxt"" width=""30"">"

      .Text += "<input "

      If idnr = 1 Then

         .Text += "CHECKED "

         selectedcar = row("ImageUrl")

      End If

.Text += "class=""form"" type=""radio"" name=""Cartype"" id=""" & idnr & """ onclick=""showpic('" & row("ImageUrl") & "','" & idnr & "');"" value=""" & row("CarData") & "¤" & row("CarName") & "¤" & row("OnRequest") & "¤" & row("CarPrice") & """>"

      .Text += "</td><td class=""normaltxt"" width=""17%"">"

      .Text += row("ProductGroup")

      .Text += "</td><td class=""normaltxt"" width=""17%"">"

      Dim req As String

      If row("OnRequest") <> 0 Then

         req = "<span class=""carrequest"">" & GetText.GetText(564) & "</span>"

      Else

         req = "<span class=""caravaible"">" & GetText.GetText(565) & "</span>"

      End If

      .Text &= req

      .Text += "</td><td class=""normaltxt"" width=""17%"" align=""right"">"

      .Text &= row("CarPrice") & " " & PriceType

      .Text += "</td><td class=""normaltxt"" width=""17%"" align=""center"">"

      .Text &= row("MinDriverAge")

      .Text += "</td></tr><tr><td>&nbsp;</td><td class=""normaltxt"" colspan=""4"">"

      .Text += GetText.GetText(566) & " " & row("CarName")

      .Text += "</td></tr></table>"

      .Text += "<hr />"

   End With

Next

the creation of the javascript:

Dim javashowpic As String

javashowpic = "<script language='javascript'>"

javashowpic += "function showpic(imgid,data) {"

javashowpic += "document.getElementById('carimg').src = 'http://www.holidayautos.se/images/cars/' + imgid;"

javashowpic += "document.getElementById('TextBox5').value = document.getElementById(data).value;"

javashowpic += "}"

javashowpic += "</script>"

Page.RegisterClientScriptBlock("showpic", javashowpic)

'Panel1.Visible = False

If tempset.Tables("Products").Rows.Count > 0 Then

   Page.RegisterStartupScript("showpicstart", "<script language='javascript'>showpic('" & selectedcar & "','1')</script>")

   Panel2.Visible = True

Else

   lblterror.Text = "<br /><br />" & GetText.GetText(567)

End If

im thinking that it may be something that the page supported and the usercontrol dont, but ive tried everything i can think of.

Any help would be greatly appreciated.

-Anders Bohlin

0
andersbohlin
4/19/2005 2:59:48 PM
asp.net.getting-started 91979 articles. 3 followers. Follow

0 Replies
652 Views

Similar Articles

[PageSpeed] 12

Reply:

Similar Artilces:

Getting value from a textbox control that was filled with a value from javascript
 I have a textbox control (seen below txtMileageDollars1) that gets filled with javascript based on the number of miles a user types into another textbox (txtMileageMiles1) control.  When I post back with the submit button, the value is blank.  I've tried setting EnableViewState to false, but still cannot get a value on postback.  Does anyone have a solution?   Miles<asp:TextBox ID="txtMileageMiles1" runat="server" Width="50px"></asp:TextBox>   Total (txtMileageMiles1 * rate with javascript)<asp:TextBox...

How do I get get values of controls inside datalist?
How do I get values of controls inside datalist?   For example, if I have a label inside header template or item template or footer template? Is there anyway to change property of label or any other controls inside those template as well? I would really appreciate if anybody can just post a sample code or a helpful link about datalist? Would really like to know more about the events fired for datalist, itembound, itemcreating etc?   hey there,I used this page to work out how to use datalists http://www.eggheadcafe.com/tutorials/aspnet/d89d1d96-03f1-4784-bbb2-a3db1af...

POST GET GET GET GET... WTH?
Hi, I'm at a loss to explain this... I have an ASPX page that I can't always navigate to. When I developed the app (it's Starter Kit Portal-based), I did it on my LAN and have had no trouble accessing the page. However, upon deployment, I see the following behavior: 1. POST request goes out looking for MyForm.aspx 2. GET request for MyForm.aspx 3. GET request for MyForm.aspx 4. ... X. GET request Sometimes, the page finally loads. Other times, it just ends up blank. Many times, it doesn't load at ALL the first POST - I just get a "The pa...

using javascript getting value from textbox when edit button is clicked and both controls are present in gridview control
Hi All using javascript I want to get value  from textbox when edit button is clicked and both controls that is texbox and button are present in gridview control .Alok Hi aloksinha83, Please see this post: http://forums.asp.net/t/1069245.aspx Thanks,Qin Dian TangMicrosoft Online Community SupportPlease remember to mark the replies as answers if they help and unmark them if they provide no help....

get value from javascript to web control
In my page I have label control <asp:label id="Label1" runat="server" /> when page load I set that label value using javascript function setvalue() { document.getElementById("Label1").innerHTML = "hello" } <body onLoad="setvalue();"> and i also have a button. When I click that button, it read the label value Private Sub BtnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSubmit.Click Dim a as string = Label1.Text end sub but the problem is var...

Getting values from Javascript controls to dotnet
I am creating few controls like textboxes dynamically using javascript , now how do I get values of those controls once I submit the page in dotnet. You have to use the Request.Form collection.  Note that this collection only stores the values of the textboxes.  Example: Dim strName as String = Request.Form("txtName") Hope this helps!  Please mark the helpful post(s) as Answer.Josh Stodola ← Come check out my blog! In your page_load you can have something like this: Dim test As New TextBox test.ID = "txtTest" test.Text = "Test" M...

how to get label control value in javascript.
 Hi I need to get the label Text when the User clicks the browser close button.function fnPassValues() {     if((window.event.clientX < 0) || (window.event.clientY < 0))     {        var temp = document.getElementById("<%=lblValue.ClientID%>").innerText;        alert(temp);     } }If i set the value like this, its working correctly. <asp:Label ID="lblValue" Text="3" Height="20px" runat="server" CssClass=&quo...

Unable to get values of a bounded control when postingback, How do I get previous state?
the second DDL doesn't work, cuz the items are refilled in the postback event.and of course if I fill in the items only if Not Page.IsPostBack, it doesn't fill anything. however, how can I get the previous DropDownList2 instantiated control, I mean I want to get the control as it would be looking before the user changed index + new selected index as an argument. or else - maybe I have to do it completely in a different way (?).  <%@ Page Language="VB" %> <%@ Import Namespace="System.Linq" %> <!DOCTYPE html PUBLIC "-//W3C/...

How to pass in value to javascript from database or let javascript to get value from database?
I am trying to use google map api to do some web based application.On the map, the javascript needs latitude and longitude from database to draw a marker on page load, I am wondering how can I get the data from database to do that? The map part will be like a image, won't change.Do I need Ajax?Thank you.  hanxiao:I am trying to use google map api to do some web based application.On the map, the javascript needs latitude and longitude from database to draw a marker on page load, I am wondering how can I get the data from database to do that? The map part will be like a image, won&...

Get user input from dynamic created control, why i cant get the value???
Hi!, i was tried to dynamically generate some textboxes according the selected number in a dropdownlist, but when i need to get the user input from those textboxes.. i cant get at all!!, Can any1 guide me on tis? Below is my code.Basically, i have 1 dropdownlist (ddltbCount), 1 placeHolder(Pholder1), 1 button(btGetValue), i dont know y i cant post the html here... Private count As Integer = 1 Sub IterateThroughChildren(ByVal parent As Control) For Each c As Control In parent.Controls If c.GetType.ToString.Equals("System.Web.UI.WebControls.TextBox") AndAlso c.ID Is Nothing Then ' CType(c, T...

how to set get label control value in javascript.
How Can I get the label control let say Label1 text value in my javascript code.Kamran ShahidSr. Software Engineer(MCP,MCAD.net,MCSD.net,MCTS,MCPD.net[web])Netprosys Inc.www.netprosys.comRemember to click "Mark as Answer" on the post that helps U Hi, you can use document.getElementById(id of the label).innerText;1 <%@ Page Language="C#" %> 2 3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 4 5 <script runat="server"> 6 7 ...

how to get javascript value in C#.net pageload
Detect acrobat reader installed in client machine. I have to check this in page load. I have hidden field in .aspx to get the return value.  I had used page.registerstartupscript to execute javascript. I can execute the script but i can't retrieve the return value. I can get the value only by using  _doPostBack("hidAcrobat","1"); I need the retrieve the value without page refresh.  Can you please suggest regarding the issue. Thanks, Karnan            declare your hidAcrobat hidden variable in aspx file like b...

Iterating gridview control with javascript to get label values
I have a gridview control I need to iterate through to get some names from each row. Here is my HTML code as well as the names I need to get.<table cellspacing="0" cellpadding="2" rules="all" border="1" id="ctl00_ContentPlaceHolder1_gvAssistants" style="border-style:Solid;border-collapse:collapse;"> <tr style="background-color:DarkGray;"> <th scope="col"> </th><th scope="col">Assistants</th> </tr><tr style="white-space:nowrap;">...

How to set get label control value in javascript. #2
document.getElementByID("Label1") .innertext by this i can get label text by i want to get label value.can anyone help? Hi What do you actually mean by label value? asp:Label doesnt support any property called value . For eg if you declare a textBox something like this :- <asp:TextBox runat="server" ID="TextBox4" Text="Hii5"></asp:TextBox> then in borowser it is rendered as <input name="TextBox4" type="text" value="Hii5" id="TextBox4" /> so here you can see that you have value at...

Web resources about - javascript and getting values from controls... - asp.net.getting-started

JavaScript Kit- Your comprehensive JavaScript, DHTML, CSS, and Ajax stop
Your comprehensive JavaScript, DHTML, CSS, and Ajax stop

Let's Code: Test-Driven Javascript by James Shore — Kickstarter
James Shore is raising funds for Let's Code: Test-Driven Javascript on Kickstarter! A screencast series focusing on rigorous, professional Javascript ...

Eloquent JavaScript: A Modern Introduction to Programming
... and pragmatics. I loved the tutorial-style game-like program development. This book rekindled my earliest joys of programming. Plus, JavaScript! ...

Lightbox (JavaScript) - Wikipedia, the free encyclopedia
On a Lightbox-enabled page, a user can click an image to have it magnified in a Lightbox window, which resizes itself according to the size of ...

Open Directory - Computers: Programming: Languages: JavaScript: Tools: Obfuscators
about dmoz - help Top : Computers : Programming : Languages : JavaScript : Tools : Obfuscators Tools for obfuscation/compression JavaScript code. ...

Facebook File-Transfer App Pipe Relaunches, Now Works Via JavaScript, WebRTC
... allowed Facebook users to send and receive files up to 1 gigabit in size. A new version of Pipe debuted Monday, and the app now works via JavaScript ...

Under the Hood: The JavaScript SDK - The use of polyfills - Facebook
Facebook Engineering hat eine Notiz mit dem Titel Under the Hood: The JavaScript SDK - The use of polyfills geschrieben. Du kannst den vollständigen ...

JavaScript SDK - Facebook-Entwickler
Overview The JavaScript SDK provides a rich set of client-side functionality for accessing Facebook...

Senior Front-End Developer (Javascript and AJAX)
Company: Sometrics Category: Software Development Location: Los Angeles, CA How to Apply: jobs@sometrics.com Description: We are looking for ...

Badass JavaScript (@badass_js) on Twitter
WebGLWorker is an open source library that allows using WebGL from Web Workers. Great work as always from @kripken . blog.mozilla.org/research/2014/… ...

Resources last updated: 11/23/2015 10:16:10 AM