473,796 Members | 2,445 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

GetElementbyID question - within MasterPage/contentpage - within tables

I've inherited a project that has quite a few Table rows - inside each cell,
within the row are a couple of textboxes ("in" and "out"), along with a
"total" label.

Also - this is all within a Content Page/Master Page scenario - I've got the
function inside the Content page, along with the all the items herein

On each row, each of the in and out and total controls have a number
associated with them, like:

In1, Out1, total1
In2,Out2, total2, etc

For each Out textbox, I'm adding the onblur attribute to run this function

I'm trying to create ONE javascript function to add the in and out
textboxes, based the number of the row, which will add the two textbox
values, and put it in the label for that row, but I keep getting errors and
I'm not sure what to do....

I've got a function started but it keeps getting errors, and I'll admit I'm
not a pro with JS. Here's what I've got so far:
function getmiles(num) {
start=document. getElementById( "In" + num).getAtribut e("value"); // < -
can't find
end=document.ge tElementById("O ut" + num).getAtribut e("value");
document.getEle mentById("Total " + num).getAtribut e("value")=star t-end;
}
'num' is getting populated, for sure. The main error is
'document.getEl ementById("..") is null or not an object, plus a couple of
"object expected" errors....

it happens any time I use the structure above (document.getEl ementById("In"
+ num).getAtribut e("value"))

can someone help me here?
May 8 '07 #1
1 8567
Controls in content pages have combined id. You can see them if you view the
html source of the page when it is displayed in your browser.

This javascript function can assist you in finding controls by the tag name
and partial control id:

function findControl(tag Name, controlId)
{
var aControls = document.getEle mentsByTagName( tagName);
if (aControls==nul l)
return null;
for (var i=0; i< aControls.lengt h; i++)
{
var j = aControls[i].id.lastIndexOf (controlId);
if ((j -1) && (j == (aControls[i].id.length - controlId.lengt h)))
return aControls[i];
}
return null;
}
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Elmo Watson" <ew@yahoo.nospa m.comwrote in message
news:Or******** ******@TK2MSFTN GP06.phx.gbl...
I've inherited a project that has quite a few Table rows - inside each
cell, within the row are a couple of textboxes ("in" and "out"), along
with a "total" label.

Also - this is all within a Content Page/Master Page scenario - I've got
the function inside the Content page, along with the all the items herein

On each row, each of the in and out and total controls have a number
associated with them, like:

In1, Out1, total1
In2,Out2, total2, etc

For each Out textbox, I'm adding the onblur attribute to run this function

I'm trying to create ONE javascript function to add the in and out
textboxes, based the number of the row, which will add the two textbox
values, and put it in the label for that row, but I keep getting errors
and I'm not sure what to do....

I've got a function started but it keeps getting errors, and I'll admit
I'm not a pro with JS. Here's what I've got so far:
function getmiles(num) {
start=document. getElementById( "In" + num).getAtribut e("value"); // < -
can't find
end=document.ge tElementById("O ut" + num).getAtribut e("value");
document.getEle mentById("Total " + num).getAtribut e("value")=star t-end;
}
'num' is getting populated, for sure. The main error is
'document.getEl ementById("..") is null or not an object, plus a couple of
"object expected" errors....

it happens any time I use the structure above
(document.getEl ementById("In" + num).getAtribut e("value"))

can someone help me here?


May 8 '07 #2

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

Similar topics

1
1189
by: phil1bruening | last post by:
Hi, How can I change webcontrols from a contentpage in the masterpage?
9
4352
by: Leffe Andersson | last post by:
Hi folks! I have a MasterPage with some public methods, and I would like to call them from a (app_code) class. Is it possible to set a directive or an assembly reference to a MasterPage from a normal class? I have no problem to call the masterpage's methods from a contentpage, but what I would like to do is someting like this... public partial class MyMaster : System.Web.UI.MasterPage
9
1915
by: User | last post by:
OK, I asked in a reply, but I've wasted far too long so I'm going to put a new post out there in hopes that it will be more visible. I have a MasterPage. I want to call a method declared in that class from a Page that uses the MasterPage. How do I do that? public partial class List : System.Web.UI.MasterPage { protected ArrayList m_SortList;
5
1856
by: jeffmagill | last post by:
Is it possible? I haven't been able to find any information about this. Not on the web, not in books. Is it possible to call a function or subroutine which is defined in a MasterPage from it's derivative ContentPage? Thanks. Jeff
3
1214
by: musosdev | last post by:
Hi guys I'm using a MasterPage for my website rebuild (vs2005, .net2, c#). I want to be able to control the Title element, both on the MasterPage and the Content pages. For example, on each page I want the following to appear for the Title.. SITENAME - some page related title
7
13046
by: Bon | last post by:
Dear all I create a master page with image buttons on the left-hand side for navigation. When a user clicks the student button, the content (i.e. ContentPlaceholder) in masterpage will be changed from default.aspx to students.aspx. I tried to create a subroutine in MasterPage.master.vb to do it. The code is as following. But, the default.aspx's content is shown in MasterPage even I clicked the student button.
1
1845
by: =?Utf-8?B?Sm9obg==?= | last post by:
I have a dropdownlist in masterpage and a big table in contentpage. When ddl selection changes, I want to move a specific row of the table to the top of the contentpage. Can I do something like <a href="#mid"in ddl event handler? Maybe a Javascript? Please advise. Thanks.
4
2203
by: =?Utf-8?B?SmFwZQ==?= | last post by:
Can I refer to the controls on default.aspx from the masterpage? I have a form on the masterpage which sends information that is in a gridview in the default.aspx page.
2
1851
by: Sully | last post by:
I know this is a basic question, but I cannot find the answer. I have a 3 LinkButtons on the masterpage that set a session variable, this session variable does not get relayed to the content page until there are 2 postbacks. MasterPage: protected void lbtn01_Click(object sender, EventArgs e) { Session = "01";
0
9679
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10223
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9050
agi2029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7546
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5441
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5573
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2924
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.