|
|
Hi everybody,
Since I was having trouble locating a control within my form, I decided to use the following routine to get the name and index of every control in the form.
function clearColRd(){
for (var i=0; i < document.Form1.elements.length;i++){
alert(document.Form1.elements[i].name + ' ' + i);
}
}
Here is the actual html that renders the control, it does exist!
Place
How come I can't get to it? this control is located within a cell of a table's row. Can see the row, but not the Radiobutton.
Any ideas?
Thanks a lot, this is really messing with my head.
|
|
|
|
|
alexvw wrote: for (var i=0; i < document.Form1.elements.length;i++){
alert(document.Form1.elements[i].name + ' ' + i);
}
It might be because "Form1" doesn't exist..
Try this code below
for (var i=0; i < document.forms[0].elements.length;i++){<br />
alert(document.forms[0].elements[i].name + ' ' + i);<br />
}
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
"Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."
|
|
|
|
|
Hello Michael,
Form1 does exist, geelementbyid() locates "TBody"
docuemnt.Form1.getelementbyid('TBody') -> works!
<form id="Form1" method="post" runat="server">
<asp:Table id="TBody" runat="server" BorderStyle="None" CellPadding="0" CellSpacing="0" EnableViewState="False" Width="100%"></asp:Table>
<br>
<hr color="#cccccc" size="1">
</form>
getelementbyid() gets as far as obtaining the cells within the rows of the table, but does not get any objects within the cells.
I tried:
document.getElementById(searchTag).rows[i].cells[2].children[0].children[0].children[0].children[0].getElementsByTagName('INPUT');
apparently this works with IE, and Opera, but Firefox issues an error:
"document.getElementById(searchTag).rows[i].cells[2]." has no properties!
I am trying to access a radiobutton inside a cell inside a row inside a table inside a cell inside a row inside TBody. (the reason of such a set up is for visual appearance)
this would be its representation:
TBody.Row[i].cells[2].innertable.row[0].cells[0].radiobutton.
Hopes this gives you a clearer idea of the little mess I have in here
thanks for you time and help.
-- modified at 11:29 Tuesday 27th November, 2007
|
|
|
|
|
Hi
In my asp vb.net project on root i create one folder named menu in that menu i create two folder named CST,
ADMIN,PMT ther i put respective .js file. In the root i create Master folder and stored my pages BUt the menu does not displayed properly and also if i click on menu it dont work. but the pages which are stored on root are working
very fine .
<
<% if Session("designation")="Branch" then %>
<% End if%>
<% if Session("designation")="Admin" then %>
<% End if%>
<% if Session("designation")="PMT" then %>
<% End if%>
<% if Session("designation")="Accountant" then %>
<% End if%>
>
code added in html is given below
img folder is there on root.
Pl advice me how to solve this problem.
Regards
Sonia
|
|
|
|
|
|
I have a swf which I have embedded in a page. The page has two frames, with no borders between them. The flash is supposed to play in the top frame, and the rest of the site sits in the bottom frame. The thing is, they are supposed to butt up to one another, and I am finding if I don't specify a frame size that's 34 pixels higher than the size of the swf, I get scrollbars in the top frame. As it stands, I have a big gap where I'd like things to be nice and snug. how do I do that ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Christian here is what you have to do, I have tested in IE:
in your main page do this:
<br />
<FRAMESET frameborder= "0 px" framespacing="0 px" Rows="217, *" ><br />
<FRAME name="xSelection" src="frame1.htm" scrolling="no" NORESIZE><br />
<FRAME name="xIndividualStore" src="frame2.htm" scrolling="no" NORESIZE><br />
</FRAMESET><br />
Rows for the first frame should be fixed. you might have to test for the flash object by increasing and decreasing the number of rows until it fits the flash object. Rows for the second frame can be automatic.
And top and bottom margins (margins in body tag of both pages) for frame1.htm and frame2.htm should be 0.
This way you will get your required results. Make sure your flash object does not have any blank lines at the end.
-----
|
|
|
|
|
Awesome. I had to make the top margin -2 in my lower frame, but it's all looking good now. Thank you.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi Friends,
I am using Framework 2.0. I am compiling a web service in runtime dynamically creating a proxy and want to invoke that method by passing a reference to the web service that is of the type XML.
I get the error "Cannot serialize member CT_ToolKit.UtilityXmlBase.Properties of type System.Collections.Hashtable, because it implements IDictionary" when I call the web service in the browser
Please provide a solution to my problem with the code how it has to be modified. The code submitted contains only some of the methods and not all with which is required.
Classes used:
-------------
public class UtilityXmlBase : IComparable
{
public virtual ToolData ToolInterface { get { return null; } }
public virtual ToolValueData ValueData
{ get
{ return new ToolValueData(ref m_element); } } // public property allows access to this as a ToolData object
protected XmlElement m_element;
// the properties tabel has been moved to the base class as any entity has the option of containgin properties.
// NB Properties are inteded to hold data that can be usefully displayed tothe user. Not data used by the internal workings of the
// toolkit. Internal data should be kept as attributes
protected Hashtable m_properties; public Hashtable Properties { get { return m_properties; } }
protected Hashtable m_matrices; public Hashtable Matrices { get { return m_matrices; } }
// universally available timestamp property
private String CreationTime { get { return GetAttribute(CT_Const.xml_Common_Att_Creation); } set { SetAttribute(CT_Const.xml_Common_Att_Creation, value); } }
///
/// Function ensure consitent creation time format
///
public void SetCreationTime()
{
CreationTime = DateTime.Now.ToString();
}
}
public class ScenarioModel : UtilityXmlBase
{
XmlElement m_scenarioElement { get { return m_element; } set { m_element = value; } } // m_scenario element is a property for internal use
public ScenarioModel()
{
}
// it gives us renamed reference to the base member m_element
// I dont like this being public but it is neccessary for the remote web service
// to be able to extract the xml.
public XmlElement ScenarioElement { get { return m_scenarioElement; } }
public String Name { get { return GetAttribute("Name"); } set { SetAttribute("Name", value); } }
public String ID { get { return GetAttribute("id"); } internal set { SetAttribute("id", value); } }
public String LastUpdate { get { return GetProperty("lastUpdate"); } protected set { SetProperty("lastUpdate", value); } }
public String LastID { get { return GetAttribute("lastId"); } internal set {SetAttribute("lastId", value);}}
public String Owner { get { return GetAttribute(CT_Const.xml_Common_Att_Owner); } set { SetAttribute(CT_Const.xml_Common_Att_Owner, value); } }
internal ScenarioModel(XmlElement element)
:base(element)
{
m_scenarioElement = element;
}
internal XmlElement Parent { get { return (XmlElement)m_scenarioElement.ParentNode; } } // the parent node of the scenario
/*
}
public class ScenarioController : ScenarioModel, IScenarioServices, IXmlSerializable
{
//ScenarioController m_ParentScenario; // parent scenario
// arrays of mods, components and Tools
Hashtable m_mods; public Hashtable Mods { get { return m_mods; } }// array of mods in scenario
Hashtable m_components; public Hashtable Components { get { return m_components; } }// hashtable of components in scenario
Hashtable m_tools; public Hashtable Tools { get { return m_tools; } } // array of tools in scenario
Hashtable m_linkages; public Hashtable Linkages { get { return m_linkages; } }
//SCP - Add comments
String m_comments; public String Comments { get { return m_comments; } set { m_comments = value.ToString(); UpdateComments(value.ToString()); } }// comments in scenario
public ScenarioController()
{
}
}
Web Service Implementation:
--------------------------
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using CT_ToolKit;
using System.Xml;
using System.Xml.Serialization;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{
public Service () {
//Uncomment the following line if using designed components
//InitializeComponent();
}
private void InitializeComponent()
{
throw new Exception("The method or operation is not implemented.");
}
//The object theScenario will have a reference passed in an XML format.
[WebMethod(Description = "Calculations for Motor")]
//[XmlInclude(typeof(XmlDocument[]))]
public ScenarioController Toolone(ScenarioController theScenario)
{
string t_Uv0 = "0", d_M = "0", m_cosPhi = "0", t_I2 = "0";
// for fetching the scenario details (code starts)
//ScenarioController seCtrl = (ScenarioController)theScenario;
ScenarioController seCtrl = new ScenarioController();
ComponentController[] ccs = seCtrl.GetComponents();
foreach (ComponentController cc in ccs)
{
PropertyController[] pps = cc.GetProperties();
foreach (PropertyController pp in pps)
{
if (pp.Name == "Transformer_Uv0")
{
t_Uv0 = pp.Value;
}
if (pp.Name == "Transformer_I2")
{
t_I2 = pp.Value;
}
if (pp.Name == "Drive_m")
{
d_M = pp.Value;
}
if (pp.Name == "M_Sync_AC_cosPhi")
{
m_cosPhi = pp.Value;
}
}
}
// formula calculation starts
double uv0 = Convert.ToDouble(t_Uv0);
double i2 = Convert.ToDouble(t_I2);
double cosPhi = Convert.ToDouble(m_cosPhi);
double drive_M = Convert.ToDouble(d_M);
// INTERMEDIATE CALCULATION (DC)
double udc = uv0 * 3 * (1.414 / 3.14);
double idc = i2 * 3.14 / 2.449;
// OUTPUT CALCULATION (AC)
double m_Sync_U = udc * (drive_M / 1.414);
double m_Sync_I = (udc * idc) / (m_Sync_U * cosPhi);
decimal m_Sync_U1 = decimal.Round(Convert.ToDecimal(m_Sync_U), 2);
decimal m_Sync_I1 = decimal.Round(Convert.ToDecimal(m_Sync_I), 2);
// formula ends
// FOR UPDATING THE PROPERTY IN THE GRID VIEW
foreach (ComponentController cc1 in ccs)
{
PropertyController[] pps1 = cc1.GetProperties();
foreach (PropertyController pp1 in pps1)
{
if (pp1.Name == "M_Sync_AC_U")
{
pp1.SetValue(m_Sync_U1.ToString());
}
if (pp1.Name == "M_Sync_AC_I")
{
pp1.SetValue(m_Sync_I1.ToString());
}
}
}
//return (theScenario);
return (seCtrl);
}
// for fetching the scenario details (code ends)
}
Client Code to invoke the Web Service:
-------------------------------------
object wsvcClass = results.CompiledAssembly.CreateInstance(serviceName);
MethodInfo mi1 = wsvcClass.GetType().GetMethod(methodName);
object Result = null;
try
{
Result = mi1.Invoke(wsvcClass, args);
}
Armstrong
-- modified at 6:17 Tuesday 27th November, 2007
|
|
|
|
|
How to retrieve a image from a database and display it along with other components on the same web page using JSP in HTML?
|
|
|
|
|
I assume the core rules are the same, the way to do this is to register a custom page type, which calls code which returns the byte stream that represents the image.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
|
I am working on SEO based project. In this project I need to find reciprocal website of other site. means here i need to find that the url site who wants to put their name on my site, then that site should also have my url address in thier site. so how can I find that whehter the requested site contains my url address or not. Please help me. Thanks in advance
|
|
|
|
|
Don't cross post. You've done this in 4 different forums and it is blatantly rude!
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
You can use Webrequest and WebResponse to get the HTML source of a particular page..
For example ~
public String GetHtmlPage(string strURL)<br />
{<br />
String strResult;<br />
WebResponse objResponse;<br />
WebRequest objRequest = System.Net.HttpWebRequest.Create(strURL);<br />
objResponse = objRequest.GetResponse();<br />
using (StreamReader sr = <br />
new StreamReader(objResponse.GetResponseStream()))<br />
{<br />
strResult = sr.ReadToEnd();<br />
sr.Close();<br />
}<br />
return strResult;<br />
}
Ref : http://www.csharpfriends.com/Articles/getTip.aspx?articleID=210
Hope it helps.
Note: Please don't cross post. You should wait until you get the reply...
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
"Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."
|
|
|
|
|
Hello,
I'm trying to connect Oracle database with HTML frontend using JSP. I tried displaying contents of a table but it shows the contents even after i delete them from the table. Can someone help please? I'm new to this.
Also, i need to insert 500 chars of data. Tried varchar2 and long datatype but my oracle shows it should be under 241 chars. What should i do? I use Oracle 9i.
|
|
|
|
|
gReaen wrote: I tried displaying contents of a table but it shows the contents even after i delete them from the table.
Sounds like you either have to refresh the table or commit the changes to the database.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
I tried deleting it directly from the table. It clearly shows that there are zero rows in the table but, the webpage still displays it. Is there any alternatives to reflect that change on the webpage?
|
|
|
|
|
Two reasons:
1) Commit Changes After Deleting Rows
2) Page being displayed from cache
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
Hi,
I wanted to know what the best method is to retrieve a image from a database and display it along with other components on the same web page.
I have searched for a number of methods, most of them use a picturebox (which is not available to me as im making a web application), or they use Response.BinaryWrite to display the image to another webpage (tried this method, can not get the image to display with other components).
I am also not to keen on creating a temporary file.
Please help, I have been stuck with this problem for 2 weeks now and im going crazy!!
Thank You,
Faesel Saeed
|
|
|
|
|
You need to create a http handler for a custom extension, and use that to binary write your image back to the page. When you write an img tag, a seperate HTTP request happens to download from the URL, so you need to provide a URL that will be caught by your handler, load the image bytes and stream them back.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi Christian,
Thanks a lot for your reply you wisdom is greatly appreciated,
I have implemented a http handler and successfully displayed the image to the browser, only problem is that it now overwrites everything and is the first thing seen when starting the web application. As soon as the web application is loaded the http handler is called.
By the way I am a noob at this so don't laugh at me if I write something stupid. Could you please tell me if I am doing something wrong?
Http handler:
public class ImageHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
Game game = new Game();
Byte[] image = game.retrieveImage(_imageId);
context.Response.BinaryWrite(image);
}
}
Web.config:
<httpHandlers>
<add verb="*" path="*.*" type="WebApplication.ImageHandler, WebApplication"/>
</httpHandlers>
and image tag:
<asp:Image ID="Image1" runat="server" ImageUrl="ImageHandler.ashx"/>
Thanks,
Faesel Saeed
|
|
|
|
|
Hi,
Ignore my previous post I have since discovered the problem, if anyone is interested in what i did i have shown my coding below:
web.config file:
<system.web>
<httpHandlers>
<add verb="*" path="http://localhost:1130/Game.*" type="WebApplication.ImageHandler, WebApplication"/>
</httpHandlers>
</system.web>
NOTE: before I had an incorrect path....very incorrect
Image tag:
<asp:Image ID="Image1" runat="server" ImageUrl="~/ImageHandler.ashx?id=1"/>
http handlers .ashx code:
public class ImageHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
int _imageId;
if (context.Request["id"] != null) //Parameter being passed from the image tag
{
_imageId = int.Parse(context.Request["id"]);
}
else
{
throw new ArgumentException("No parameter specified");
}
Game game = new Game();
Byte[] image = game.RetrieveImageDB(_imageId);
context.Response.BinaryWrite(image);
}
public bool IsReusable
{
get
{
return false;
}
}
}
Hope this helps,
Faesel Saeed
|
|
|
|
|
How does connection pooling work between SQL Server and classic ASP?
What if the Hokey Kokey IS what it's all about?
|
|
|
|