Greeting
I built asp.net (V1.1) page.
I want to use this button to reset SelectedIndex=0 on several drop
down lists. However, I do not want to post back to server. The point
is to avoid the round trip.
It had an asp:button which would post back to the server when clicked
but changed it to an input button to avoid the postback. (If that is
not needed,let me know)
So, I now have
<input type=button value="clear" onclick="Clear_ddls()">
in header of page I have script
function Clear_ddls()
{
want to set ddlLastName.selectedIndex = 0;
}
I know the script runs because I put an alert message in there.
I do not know how to reference the drop down lists contained on my
asp.net page from in the script.
I tried different forms of document.get..., or Form1.ddlLastName,
etc.. but can not get it to work.
My form contains
<ASP:dropdownlist id="ddlLastName"
runat="server" bla bla></asp:dropdownlist>
This list (and others ) are populated on server side. That is ok for
me. I just want to be able to reset it on client side with script.
Can I do this?
thanks
Jeff 3 1461
you need to use the ClientId property of the controls to know the name. try:
function Clear_ddls()
{
document.getElementById('<%=ddlLastName.ClientId%> ').selectedIndex =
0;
}
-- bruce (sqlwork.com)
"Jeff User" <je*******@hotmail.com> wrote in message
news:n2********************************@4ax.com... Greeting
I built asp.net (V1.1) page. I want to use this button to reset SelectedIndex=0 on several drop down lists. However, I do not want to post back to server. The point is to avoid the round trip.
It had an asp:button which would post back to the server when clicked but changed it to an input button to avoid the postback. (If that is not needed,let me know)
So, I now have <input type=button value="clear" onclick="Clear_ddls()">
in header of page I have script function Clear_ddls() { want to set ddlLastName.selectedIndex = 0; }
I know the script runs because I put an alert message in there. I do not know how to reference the drop down lists contained on my asp.net page from in the script. I tried different forms of document.get..., or Form1.ddlLastName, etc.. but can not get it to work.
My form contains <ASP:dropdownlist id="ddlLastName" runat="server" bla bla></asp:dropdownlist>
This list (and others ) are populated on server side. That is ok for me. I just want to be able to reset it on client side with script.
Can I do this? thanks Jeff
Bruce
I have the script running wo any errors, but the drop down list does
not change appearance on the screen. Does this mean it isn't working
or do I have to do something to get the drop down to re-display itself
with its new index (assuming it has been reset to 0)
Thanks
Jeff
On Tue, 16 May 2006 11:37:17 -0700, "bruce barker \(sqlwork.com\)"
<b_*************************@sqlwork.com> wrote: you need to use the ClientId property of the controls to know the name. try:
function Clear_ddls() { document.getElementById('<%=ddlLastName.ClientId%> ').selectedIndex = 0; }
-- bruce (sqlwork.com)
"Jeff User" <je*******@hotmail.com> wrote in message news:n2********************************@4ax.com.. . Greeting
I built asp.net (V1.1) page. I want to use this button to reset SelectedIndex=0 on several drop down lists. However, I do not want to post back to server. The point is to avoid the round trip.
It had an asp:button which would post back to the server when clicked but changed it to an input button to avoid the postback. (If that is not needed,let me know)
So, I now have <input type=button value="clear" onclick="Clear_ddls()">
in header of page I have script function Clear_ddls() { want to set ddlLastName.selectedIndex = 0; }
I know the script runs because I put an alert message in there. I do not know how to reference the drop down lists contained on my asp.net page from in the script. I tried different forms of document.get..., or Form1.ddlLastName, etc.. but can not get it to work.
My form contains <ASP:dropdownlist id="ddlLastName" runat="server" bla bla></asp:dropdownlist>
This list (and others ) are populated on server side. That is ok for me. I just want to be able to reset it on client side with script.
Can I do this? thanks Jeff
No other ideas?
Any body?
Jeff
On Tue, 16 May 2006 11:37:17 -0700, "bruce barker \(sqlwork.com\)"
<b_*************************@sqlwork.com> wrote: you need to use the ClientId property of the controls to know the name. try:
function Clear_ddls() { document.getElementById('<%=ddlLastName.ClientId%> ').selectedIndex = 0; }
-- bruce (sqlwork.com)
"Jeff User" <je*******@hotmail.com> wrote in message news:n2********************************@4ax.com.. . Greeting
I built asp.net (V1.1) page. I want to use this button to reset SelectedIndex=0 on several drop down lists. However, I do not want to post back to server. The point is to avoid the round trip.
It had an asp:button which would post back to the server when clicked but changed it to an input button to avoid the postback. (If that is not needed,let me know)
So, I now have <input type=button value="clear" onclick="Clear_ddls()">
in header of page I have script function Clear_ddls() { want to set ddlLastName.selectedIndex = 0; }
I know the script runs because I put an alert message in there. I do not know how to reference the drop down lists contained on my asp.net page from in the script. I tried different forms of document.get..., or Form1.ddlLastName, etc.. but can not get it to work.
My form contains <ASP:dropdownlist id="ddlLastName" runat="server" bla bla></asp:dropdownlist>
This list (and others ) are populated on server side. That is ok for me. I just want to be able to reset it on client side with script.
Can I do this? thanks Jeff This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jeff Uchtman |
last post by:
Have a 5 page simple (?) form that the customer wants end users to be able
to do next back at will while filling this out (not sure why). Had some
problems with the back button and versions of IE...
|
by: Martial Spirit |
last post by:
Hello-
I was amazed at the suckerfish drop-downs from AListApart.com. They
work great except for one thing, if I position the drop-downs over an
iframe element, on mouseover the menus disappear....
|
by: Kim14 |
last post by:
Help!
I am trying to create a webpage and it would be obvious to anyone who
reads my source code (it's a mess) that I created it using a template.
I know almost nothing about webpages, but am...
|
by: IGotYourDotNet |
last post by:
I have 2 drop downs on my screen the second one is displayed and populated
based on the selection of the first drop down.
The problem i'm having is that when a user selects something it keeps going...
|
by: NancyASAP |
last post by:
Thought I'd share this since it took me a long time to get it working.
Thanks to a bunch of contributers in Google Groups who shared
javascript, etc.
The question was: How can I put a reset...
|
by: Joe Dunleavy |
last post by:
Hi Guys,
Hopefully some one will have come across this issue already. I have a
DataGrid inside a Div where a scroll bar displays once a certain height is
meet
--> <div id="dvSales"...
|
by: Prabhupl |
last post by:
Hi
I have an problem in asp.net code behine vb.net. :confused: I need to clear the controls while postback the page. eg:- i am getting the input of an child information(name, age, qualification,...
|
by: John |
last post by:
I have CSS drop down navigatoon bar and it works fine.
However, when I have page where I have an <embed - needed to show a PDF
file, such as:
<embed src="Security.pdf" width="900"...
|
by: Rob Meade |
last post by:
Hi all,
Looking for a bit of help if possible.
For about 2 weeks now I've been investigating the best way to populate
related drop down menus, and have their values pre-populated again if the...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM).
In this month's session, the creator of the excellent VBE...
|
by: MeoLessi9 |
last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: marcoviolo |
last post by:
Dear all,
I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
| |