Hello All,
I have a user control which has an ASP.Net dropdown, gets filled up
from database, and is supposed to open a document when the selected
index is changed. The control itself is usually nested within a
container on the page.
IE7 treats the act of opening the document from the dropdown as the
popup and blocks it. I do the opening using javascript:
string script = @"<SCRIPT language='javascript'>window.open('" + path +
"');</SCRIPT>";
Response.Write(script);
So I wanted to do the javascript on the client (put it into the
onchange event), but I cannot reference the dropdown, because it's id
is generated by the asp, and becomes
OuterContainer_UserControl_DropdownName.
Question: How do I get to that generated name?
Question2: is there any other, more elegant way to open up the
document?
Thank you. 3 1378
If I understand correctly, you can get a refernece to the server side
control in ASP.NET by the ClientID property:
var ddl = document.getElementById("<%=myDropDown.ClientID%>" );
ddl.selectedIndex....
Karl
-- http://www.openmymind.net/ http://www.fuelindustries.com/
<al****@gmail.comwrote in message
news:11**********************@m7g2000cwm.googlegro ups.com...
Hello All,
I have a user control which has an ASP.Net dropdown, gets filled up
from database, and is supposed to open a document when the selected
index is changed. The control itself is usually nested within a
container on the page.
IE7 treats the act of opening the document from the dropdown as the
popup and blocks it. I do the opening using javascript:
string script = @"<SCRIPT language='javascript'>window.open('" + path +
"');</SCRIPT>";
Response.Write(script);
So I wanted to do the javascript on the client (put it into the
onchange event), but I cannot reference the dropdown, because it's id
is generated by the asp, and becomes
OuterContainer_UserControl_DropdownName.
Question: How do I get to that generated name?
Question2: is there any other, more elegant way to open up the
document?
Thank you.
That worked, thank you.
However, selectedIndex gives me only the number of the selected item.
Is there a way to access the "value" property of the dropdown? That's
where I have the actual file name.
Thank you.
Karl Seguin [MVP] wrote:
If I understand correctly, you can get a refernece to the server side
control in ASP.NET by the ClientID property:
var ddl = document.getElementById("<%=myDropDown.ClientID%>" );
ddl.selectedIndex....
Karl
-- http://www.openmymind.net/ http://www.fuelindustries.com/
<al****@gmail.comwrote in message
news:11**********************@m7g2000cwm.googlegro ups.com...
Hello All,
I have a user control which has an ASP.Net dropdown, gets filled up
from database, and is supposed to open a document when the selected
index is changed. The control itself is usually nested within a
container on the page.
IE7 treats the act of opening the document from the dropdown as the
popup and blocks it. I do the opening using javascript:
string script = @"<SCRIPT language='javascript'>window.open('" + path +
"');</SCRIPT>";
Response.Write(script);
So I wanted to do the javascript on the client (put it into the
onchange event), but I cannot reference the dropdown, because it's id
is generated by the asp, and becomes
OuterContainer_UserControl_DropdownName.
Question: How do I get to that generated name?
Question2: is there any other, more elegant way to open up the
document?
Thank you.
Man, am I lazy or what? The first link on google gave me the answer:
ddl.options[ddl.selectedIndex].value
Thank you, Karl. al****@gmail.com wrote:
That worked, thank you.
However, selectedIndex gives me only the number of the selected item.
Is there a way to access the "value" property of the dropdown? That's
where I have the actual file name.
Thank you.
Karl Seguin [MVP] wrote:
If I understand correctly, you can get a refernece to the server side
control in ASP.NET by the ClientID property:
var ddl = document.getElementById("<%=myDropDown.ClientID%>" );
ddl.selectedIndex....
Karl
-- http://www.openmymind.net/ http://www.fuelindustries.com/
<al****@gmail.comwrote in message
news:11**********************@m7g2000cwm.googlegro ups.com...
Hello All,
>
I have a user control which has an ASP.Net dropdown, gets filled up
from database, and is supposed to open a document when the selected
index is changed. The control itself is usually nested within a
container on the page.
>
IE7 treats the act of opening the document from the dropdown as the
popup and blocks it. I do the opening using javascript:
>
string script = @"<SCRIPT language='javascript'>window.open('" + path +
"');</SCRIPT>";
Response.Write(script);
>
So I wanted to do the javascript on the client (put it into the
onchange event), but I cannot reference the dropdown, because it's id
is generated by the asp, and becomes
OuterContainer_UserControl_DropdownName.
>
Question: How do I get to that generated name?
Question2: is there any other, more elegant way to open up the
document?
>
Thank you.
>
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: louise raisbeck |
last post by:
Resending this as own topic as didnt get answer from original. Would be
grateful for a response from anyone that knows. Thanks.
Hi there, I found your post really helpful..but i wondered if, once...
|
by: Leeor Chernov |
last post by:
Hi
I am using a <asp:Table> in a user control I created and in the loop of inserting another user control( a custom Calendar)
to the TableCell by the code:...
|
by: SlimFlem |
last post by:
I hope this makes sense.
Here is what I am attempting. I have an inital generic aspx page that
has one custom tag:
<web:site id=webSite runat=server/>
When this control evaluates, it will...
|
by: Bruce |
last post by:
Although I have quite a bit of WinForms experience, I am new to ASP.NET. So
don't be surprised by the elementary question. :)
I am creating a webpage with a dropdown list that allows the...
|
by: Gummy |
last post by:
Hello,
I created a user control that has a ListBox and a RadioButtonList (and other
stuff). The idea is that I put the user control on the ASPX page multiple
times and each user control will...
|
by: intrader |
last post by:
The situation is that I would like to generate different XHTML depending
on where the control is rendered as per example:
1. If control is placed within a <divor <spanoutput <p>something</p>...
|
by: ChopStickr |
last post by:
I have a custom control that is embedded (using the object tag) in an html document.
The control takes a path to a local client ini file.
Reads the file.
Executes the program specified in...
|
by: robgallen |
last post by:
I have 2 user controls within a master page, and I would like one of
them to call a function in the other.
All the examples I have seen involve a page communicating with the
Master page, or with...
|
by: =?Utf-8?B?UmljaEI=?= |
last post by:
I am trying to create a project using the ASP.NET AJAX accordion control. I
would like to dynamically add panes to the control with a form template added
when the pane is added. I have tried...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
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: 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...
| |