473,569 Members | 2,901 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript hyperlink ID in a Datalist = Undefined

I have an ASPX page with a DataList. The ListItems contain a
DropDownList and a Hyper Link. The user selects an Item from the
Dropdown box and then selects the hyperlink to edit that item.

My thought was to grab the ID, ClientID, or UniqueID of the Hyperlink
and then build the name of the DropDownList to grab the value to pass.
The problem is that the value keeps coming back Undefined. How can I
get the dynamic name created at runtime?

My Code:

**javascript**
function floorplanpopup( i)
{
var j = i.ClientId.leng th - 33;
var no = i.ClientId.subs tring(20, j);
var x =
document.getEle mentById("dl_no tification:_ctl "+no+":dd_floor plan");
day = new Date();
id = day.getTime();
eval("page"+id + " =
window.open('Fl oorPlanSetup.as px?did="+x.valu e+"', '" + id + "',
'width=350, height=500');") ;
}

**Datalist Code**
<asp:label class="lblnorma l" id="lbl_floorpl an" runat="server"
Font-Size="X-Small">Floor Plan Name:</asp:label>

<asp:dropdownli st class="normal" id="dd_floorpla n" runat="server"
DataTextField=" FLOORPLAN_NAME"
DataValueField= "FLOORPLAN_ID"> </asp:dropdownlis t>

<asp:HyperLin k id="hl_floorpla n" runat="server"
NavigateUrl="ja vascript:floorp lanpopup(this); "
ImageUrl="image s/AddButton.gif"> </asp:HyperLink>
Anyhelp is greatly appreciated.

~Brad

Apr 25 '06 #1
2 2276
you want the uniqueid or calc dropdown id from passed.

function floorplanpopup( i)
{
var x =
document.getEle mentById(i.id.r eplace(/hl_floorplan/i,'dl_floorplan '));
.....

-- bruce (sqlwork.com)
<mi******@gmail .com> wrote in message
news:11******** *************@t 31g2000cwb.goog legroups.com...
I have an ASPX page with a DataList. The ListItems contain a
DropDownList and a Hyper Link. The user selects an Item from the
Dropdown box and then selects the hyperlink to edit that item.

My thought was to grab the ID, ClientID, or UniqueID of the Hyperlink
and then build the name of the DropDownList to grab the value to pass.
The problem is that the value keeps coming back Undefined. How can I
get the dynamic name created at runtime?

My Code:

**javascript**
function floorplanpopup( i)
{
var j = i.ClientId.leng th - 33;
var no = i.ClientId.subs tring(20, j);
var x =
document.getEle mentById("dl_no tification:_ctl "+no+":dd_floor plan");
day = new Date();
id = day.getTime();
eval("page"+id + " =
window.open('Fl oorPlanSetup.as px?did="+x.valu e+"', '" + id + "',
'width=350, height=500');") ;
}

**Datalist Code**
<asp:label class="lblnorma l" id="lbl_floorpl an" runat="server"
Font-Size="X-Small">Floor Plan Name:</asp:label>

<asp:dropdownli st class="normal" id="dd_floorpla n" runat="server"
DataTextField=" FLOORPLAN_NAME"
DataValueField= "FLOORPLAN_ID"> </asp:dropdownlis t>

<asp:HyperLin k id="hl_floorpla n" runat="server"
NavigateUrl="ja vascript:floorp lanpopup(this); "
ImageUrl="image s/AddButton.gif"> </asp:HyperLink>
Anyhelp is greatly appreciated.

~Brad

Apr 25 '06 #2
That really helps out in the changing of the name, but I still have the
issue that the i.id is undefined.

If I use the code you suggest, it comes back with an error: 'id' is
null or not an object.

Is it possible to pull the ID from a hyperlink?

Apr 25 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2111
by: Arjen | last post by:
Hello, Here is my datalist. <asp:DataList id="myDataList" CellPadding="4" Width="100%" runat="server"> <ItemTemplate> <span class="Normal"> <asp:HyperLink id="link" Text='<%# Server.HtmlEncode((String) DataBinder.Eval(Container.DataItem,"Title")) %>' NavigateUrl='<%# DataBinder.Eval(Container.DataItem,"Url") %>' ToolTip='<%#...
0
2205
by: Dave | last post by:
Hi , I have the following where I need to append a string variable inside a hyperlink template, inside a datalist. The variable 'categoryList' is the culprit. No matter where this variable is declared, the compiler says it is 'undefined'. What am I missing here? I am a newbie to ASP.NET trying to rebuild my ASP library.
2
1766
by: Big E | last post by:
I'm using ASP.Net and SQL Server. I have a table called states. I have 2 forms. On form 1 is the 50 states in textboxes created with a loop. I want to have those 50 or 45 or whatever amount of states have a hyperlink. Once you click the hyperlink it will take the stateId from the click event and use the Get method to send it to the next page....
9
2712
by: Leon | last post by:
What Am I Doing Wrong? Code Will Not Run, I Can't See The Error! Thanks. <asp:datalist id="DataList1" runat="server" RepeatColumns="4"> <ItemTemplate> <asp:HyperLink id=HyperLink1 ImageUrl= '<%# String.Format("Toyota/Images/Showroom/" & Container.DataItem("PathToDisplyPic"))%>' NavigateUrl='<%#
12
1400
by: Joe | last post by:
Hello All: I'm sure that one of you can quickly spot the error in my script. I am using a small javascript function to retrieve the text of a hyperlink in a datagrid column. Here is my script: function parseHyperlinkId(o) { alert(o.text);
1
1486
by: Elmo Watson | last post by:
Ok - I've got a datalist - in the template, there is a hyperlink, in which, I need to dynamically use the record's ID inside a Javascript function (a popup window function, which works perfectly with implicit ID) The problem I think, is where to put the single and double quotes - I get a The server tag is not well formed error. Here's...
0
1862
by: vidhuraj | last post by:
hi all i have a hyperlink control and image control in my datalist i have binded the values for it ie, datalist will now display some images in image control and their corresponding ID in the hyperlink control. my problem is 1)WHEN THE USER CLICKS ANY ID, IT SHOULD GET REDIRECTED TO ANOTHER PAGE WHERE HE CAN GET A DETAILED INFORMATION...
1
5724
by: rn5a | last post by:
Consider the following code: <script runat="server"> Sub Page_Load(obj As Object, ea As EventArgs) Dim sqlReader As SqlDataReader sqlReader = 'calling a function that returns SqlDataReader dlCart.DataSource = sqlReader dlCart.DataBind
7
4483
by: Peter | last post by:
I have a HoverMenuExtender which contains an asp:PlaceHolder, this place holder has a User Control and this control contrains a Button. The problem I am having is after the button fires the click event I want to do a server side function and then refresh the Page where the PlaceHolder risides. I have no problem doing the server side...
0
7605
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7917
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8118
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7665
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7962
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.