I have a web form, with c# code-behind.
I have a listbox on the form, bound to a dataset.
I want to have 2 buttons/hyperlinks/etc. beside the listbox.
When they are clicked, I want to launch a popup form, passing it some
information from the listbox (record id) and the linked information.
If I could show the data in place of the page showing, I know how to get the
data and use Response.Redirect().
Since it needs to be a popup, I know how I could use a javascript, such as:
window.open("mynextpage.aspx","_blank", "height=300, width=450,
left=100, top=100, " + "location=no, menubar=no, resizable=no, " +
"scrollbars=no, titlebar=no, toolbar=no", true);
I know that in my PageLoad() method, I could add an Onclick() method to a
hyperlink, using the .
But I don't want to do a roundtrip every time the user clicks an entry in
the listbox.
So is there some way a hyperlink button could, in the code-behind put a
javascript command into the html re-emited to the user?
Thanks! 4 1968
Add an Attribute in the code-behind.
txtFirstName.Attributes.Add("onclick","fnJavaScrip tCall()");
You could also write the client script in the code-behind like this:
public void writeScript()
{
string script = "<script language=\"javascript\">";
script += "function fnJavaScriptCall(){";
script += " Code...";
script += " }";
script += "</script>";
this.Page.RegisterStartupScript(script);
}
Regards,
-Brian K. Williams
"Nevyn Twyll" <as****@hotmail.com> wrote in message
news:eB**************@TK2MSFTNGP11.phx.gbl... I have a web form, with c# code-behind. I have a listbox on the form, bound to a dataset. I want to have 2 buttons/hyperlinks/etc. beside the listbox. When they are clicked, I want to launch a popup form, passing it some information from the listbox (record id) and the linked information.
If I could show the data in place of the page showing, I know how to get
the data and use Response.Redirect(). Since it needs to be a popup, I know how I could use a javascript, such
as: window.open("mynextpage.aspx","_blank", "height=300, width=450, left=100, top=100, " + "location=no, menubar=no, resizable=no, " + "scrollbars=no, titlebar=no, toolbar=no", true);
I know that in my PageLoad() method, I could add an Onclick() method to a hyperlink, using the .
But I don't want to do a roundtrip every time the user clicks an entry in the listbox.
So is there some way a hyperlink button could, in the code-behind put a javascript command into the html re-emited to the user?
Thanks!
Okay, but how would I get the ID Value of the currently selected row in the
listbox in order to use it in the redirect of the javascript function?
That's what I don't quite get how to do.
"Brian K. Williams" <wi*******@millenia.com> wrote in message
news:OZ**************@TK2MSFTNGP09.phx.gbl... Add an Attribute in the code-behind. txtFirstName.Attributes.Add("onclick","fnJavaScrip tCall()");
You could also write the client script in the code-behind like this: public void writeScript() { string script = "<script language=\"javascript\">"; script += "function fnJavaScriptCall(){"; script += " Code..."; script += " }"; script += "</script>"; this.Page.RegisterStartupScript(script); }
Regards, -Brian K. Williams
"Nevyn Twyll" <as****@hotmail.com> wrote in message news:eB**************@TK2MSFTNGP11.phx.gbl... I have a web form, with c# code-behind. I have a listbox on the form, bound to a dataset. I want to have 2 buttons/hyperlinks/etc. beside the listbox. When they are clicked, I want to launch a popup form, passing it some information from the listbox (record id) and the linked information.
If I could show the data in place of the page showing, I know how to get the data and use Response.Redirect(). Since it needs to be a popup, I know how I could use a javascript, such as: window.open("mynextpage.aspx","_blank", "height=300, width=450, left=100, top=100, " + "location=no, menubar=no, resizable=no, " + "scrollbars=no, titlebar=no, toolbar=no", true);
I know that in my PageLoad() method, I could add an Onclick() method to
a hyperlink, using the .
But I don't want to do a roundtrip every time the user clicks an entry
in the listbox.
So is there some way a hyperlink button could, in the code-behind put a javascript command into the html re-emited to the user?
Thanks!
This should do the job..
DropDownList1.Attributes.Add("onchange","fnGetSele ctedValue(this)");
function fnGetSelectedValue(oElement)
{
var strSelectedValue = oElement.options[oElement.selectedIndex].value;
alert(strSelectedValue);
}
Or
DropDownList1.Attributes.Add("onchange","fnGetSele ctedText(this)");
function fnGetSelectedText(oElement)
{
var strSelectedValue = oElement.options[oElement.selectedIndex].text;
alert(strSelectedValue);
}
-Brian
"Nevyn Twyll" <as****@hotmail.com> wrote in message
news:uS*************@tk2msftngp13.phx.gbl... Okay, but how would I get the ID Value of the currently selected row in
the listbox in order to use it in the redirect of the javascript function? That's what I don't quite get how to do.
"Brian K. Williams" <wi*******@millenia.com> wrote in message news:OZ**************@TK2MSFTNGP09.phx.gbl... Add an Attribute in the code-behind. txtFirstName.Attributes.Add("onclick","fnJavaScrip tCall()");
You could also write the client script in the code-behind like this: public void writeScript() { string script = "<script language=\"javascript\">"; script += "function fnJavaScriptCall(){"; script += " Code..."; script += " }"; script += "</script>"; this.Page.RegisterStartupScript(script); }
Regards, -Brian K. Williams
"Nevyn Twyll" <as****@hotmail.com> wrote in message news:eB**************@TK2MSFTNGP11.phx.gbl... I have a web form, with c# code-behind. I have a listbox on the form, bound to a dataset. I want to have 2 buttons/hyperlinks/etc. beside the listbox. When they are clicked, I want to launch a popup form, passing it some information from the listbox (record id) and the linked information.
If I could show the data in place of the page showing, I know how to
get the data and use Response.Redirect(). Since it needs to be a popup, I know how I could use a javascript,
such as: window.open("mynextpage.aspx","_blank", "height=300, width=450, left=100, top=100, " + "location=no, menubar=no, resizable=no, " + "scrollbars=no, titlebar=no, toolbar=no", true);
I know that in my PageLoad() method, I could add an Onclick() method
to a hyperlink, using the .
But I don't want to do a roundtrip every time the user clicks an entry in the listbox.
So is there some way a hyperlink button could, in the code-behind put
a javascript command into the html re-emited to the user?
Thanks!
That looks great.
However, how do I generate the code I want dynamically, in the code-behind?
Basically, I want the user to have free-reign with the listbox on the client
side, and when they press a button (hyperlink button, etc.), I want to pop
up a window with a bunch of information from the line they selected in the
listbox, which is easy to get to from the code-behind?
Should I just write a javascript method to do it anyway, and if so, how do I
access an asp control from javascript?
"Brian K. Williams" <wi*******@millenia.com> wrote in message
news:OZ**************@TK2MSFTNGP09.phx.gbl... Add an Attribute in the code-behind. txtFirstName.Attributes.Add("onclick","fnJavaScrip tCall()");
You could also write the client script in the code-behind like this: public void writeScript() { string script = "<script language=\"javascript\">"; script += "function fnJavaScriptCall(){"; script += " Code..."; script += " }"; script += "</script>"; this.Page.RegisterStartupScript(script); }
Regards, -Brian K. Williams
"Nevyn Twyll" <as****@hotmail.com> wrote in message news:eB**************@TK2MSFTNGP11.phx.gbl... I have a web form, with c# code-behind. I have a listbox on the form, bound to a dataset. I want to have 2 buttons/hyperlinks/etc. beside the listbox. When they are clicked, I want to launch a popup form, passing it some information from the listbox (record id) and the linked information.
If I could show the data in place of the page showing, I know how to get the data and use Response.Redirect(). Since it needs to be a popup, I know how I could use a javascript, such as: window.open("mynextpage.aspx","_blank", "height=300, width=450, left=100, top=100, " + "location=no, menubar=no, resizable=no, " + "scrollbars=no, titlebar=no, toolbar=no", true);
I know that in my PageLoad() method, I could add an Onclick() method to
a hyperlink, using the .
But I don't want to do a roundtrip every time the user clicks an entry
in the listbox.
So is there some way a hyperlink button could, in the code-behind put a javascript command into the html re-emited to the user?
Thanks!
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Volker Hetzer |
last post by:
Hi!
I'm new to javascript and I'd like to know whether javascript can
process javascript-code entered by the user or read from a file.
We've got an application that uses ActiveX as main...
|
by: Vanitha |
last post by:
Hi All,
I am developing a Web based application for an embedded target, using
BOA webserver.
I need to return some values to the HTML client. I am using CGI-C to
extract the values sent by...
|
by: John Owens |
last post by:
I use in Render( HtmlTextWriter output) :
//--------------------------------------------------------------------------
output.WriteBeginTag( "a" );
if( ID != null )
output.WriteAttribute(...
|
by: Venus |
last post by:
Hello,
I am trying to generate a dynamic form at runtime and would like to do it
using "<asp: ..." form elements as follows
Build up the string that is placed somewhere in the HTML code the...
|
by: Merennulli |
last post by:
Ok, did some seriously ugly meddling with javascript so that my user
can do a level of formatting which gets shunted into a hidden input
field as raw HTML code. That code is then passed back and...
|
by: Sandman |
last post by:
Hello,
I'm building a website in PHP and Javascript. The registration
portion is divided into 2 sections:
1. In one, I get info about the visitor. This is sent via POST to a php
script which is...
|
by: avanti |
last post by:
Hi,
I need to generate random alphanumeric password strings for the users
in my application using Javascript. Are there any links that will have
pointers on the same?
Thanks,
Avanti
|
by: SammyB |
last post by:
These are some "random" thoughts about generating random numbers in Visual Basic.
Wikipedia will give a better introduction than I, see http://en.wikipedia.org/wiki/Random_number_generator.
...
|
by: dwmartin18 |
last post by:
Hello everyone. I have quite the puzzling problem with a script I have been working on lately. I have created a function that can be called to create a new html element (e.g. input, select, div,...
|
by: Frinavale |
last post by:
JavaScript in ASP.NET
Using JavaScript in ASP.NET pages can make your application seem to work faster and prevent unnecessary calls to the server. JavaScript can be used to perform client-side...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |