•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 456,521 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,809 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1216 | Replies: 1 | Solved
![]() |
•
•
Join Date: Sep 2007
Posts: 81
Reputation:
Rep Power: 2
Solved Threads: 1
I have a device control panel that consist of a veiw and settings buttons. the buttons are binded to a dataset that populates the devicenumber and deviceUID
I have a javascrip function
the txtUsername texbox is define after the above script and my buttons are programed to access this function like this:
because the device name can consist of blank spaces I surrounded that parameter between a double quotes.
On the code behind, I have another set of data that I am binding to. and that information cannot be binded to the button controls. So, I binded the data to an invisible textfield and Now i would like to use it as an input parameter to either the control or the javafunction
Can anyone help?
I try to use the method bellow but does not work.
I first create a variable name named
var name;
and assign the value of the textbox to the name variable
I then used that variable as the first parameter
in the onclick button behavior.
since I am new to this web development and javascripting stuff, I don't know if the implementation is correct. the key question is how do I implement this so username has the value of the textbox? Every changes that I made return an undefined value.
I have a javascrip function
function gotoGeo(name, duid)
{
var username = document.getElementById('txtUsername');
top.main.location.href="../TrackApp/main.aspx?selectedTab=1&deviceName=" + name + "&deviceUID=" + duid + "&username=" + username;
}onclick='javascript:gotoGeo("<%# DataBinder.Eval(Container.DataItems "Name")%>", <%# DataBinder.Eval(Container.DataItems "UID")%>)'On the code behind, I have another set of data that I am binding to. and that information cannot be binded to the button controls. So, I binded the data to an invisible textfield and Now i would like to use it as an input parameter to either the control or the javafunction
Can anyone help?
I try to use the method bellow but does not work.
I first create a variable name named
var name;
and assign the value of the textbox to the name variable
name = document.getElementById('txtUsername').value;I then used that variable as the first parameter
in the onclick button behavior.
<input type="button" value="View" onclick='javascript:gotoGeo('name', "<%# DataBinder.Eval(Container.DataItems "Name")%>", <%# DataBinder.Eval(Container.DataItems "UID")%>);'>since I am new to this web development and javascripting stuff, I don't know if the implementation is correct. the key question is how do I implement this so username has the value of the textbox? Every changes that I made return an undefined value.
•
•
Join Date: Sep 2007
Posts: 81
Reputation:
Rep Power: 2
Solved Threads: 1
I solved the problem and think you for your suggestions. I couldn't have done without your input. What I did, was I allow the function to have two input parameters which will be supplied by the onclick event of the buttons.
I declared the variable username inside the gotoGeo method and I then call the document.getElementById() and assign it the txtUsername object (and it works).
I declared the variable username inside the gotoGeo method and I then call the document.getElementById() and assign it the txtUsername object (and it works).
![]() |
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- database connection(select ,insert query) within javascript function (JSP)
- Calling C# function(code behind) from javascript function (ASP.NET)
- Javascript Function Link (JavaScript / DHTML / AJAX)
- Javascript Function to reload DOM Element? (JavaScript / DHTML / AJAX)
- Trying to get a javascript function to play a sound (JavaScript / DHTML / AJAX)
- Writing a javascript function (JavaScript / DHTML / AJAX)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: 2 Websites...1 IP
- Next Thread: pass value to frame as well as refresh the frame


Linear Mode