|
I want to overriden OnLoad of an ASP.NET component like TextBox.I define it in my aspx page like this:
asp:TextBox id="TextBox1" style="Z-INDEX: 103; LEFT: 135px; POSITION: absolute; TOP: 376px" runat="server" Width="256px" Height="33px" Visible=True OnLoad="TextBoxLoad"
Now I want to define this function in my aspx with javascript code,not c# code.How can I do it?
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
You can't (at least not as far as I know). That OnLoad event is strictly server-side.
You can put an onload event on the BODY tag which would have the effect you want.
Paul
|
|
|
|
|
Thanks.I think you are right.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
I have two question,I prefered to do these in ASP.NET way but if somebody tell me javascript code for it,I can use it too,
1.How can I get the width and height of client browsers?
2.How can I get screen resolution of clients?
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
In IE the following are available...
document.body.clientWidth
document.body.clientHeight
document.body.offsetWidth;
document.body.offsetHeight;
window.screen.width
window.screen.height
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Thanks.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
|
Thanks,I'll check it.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
<%
Do While Not RS.EOF
Response.Write ""
Response.Write RS("Skill")
RS.MoveNext
Loop
%>"><% Response.Write (Session("strSkill"))%>
The option i wish to be selected is that value which is obtained from a previous form. this value is StrSkill. it is a string value. however, when adding the record to a database(in the next form), i need SkillID, which is an integer value. i am trying to obtain this by means of the SQL statement but it is not working. what is the problem, or is there an alternative soln? (note: the table is Skills : Skill(text), SkillID(int))
thank you!
|
|
|
|
|
Use CInt() in VBS to convert it.
Paul
|
|
|
|
|
my explanation was very vague-im sorry! in the next form ,i wish to add a record to a table, which requires the skillID RELATING to strSkill. this can be derived via a SQL statement (which reads the value from the database)
|
|
|
|
|
Looking again at your original message, it seems I missed the point completely, doesn't it?
I think this is the fix you're looking for:
<select NAME="Skills">
<%
Do While Not RS.EOF
Response.Write "<option VALUE='" & RS("SkillID") & "'"
If RS("Skill") = Session("strSkill") Then
Response.Write " selected"
End If
Response.Write ">" & RS("Skill") & </option>
RS.MoveNext
Loop
%>
</select> What you were trying to do would have produced:
<select NAME="Skills">
<option value="1">Skill 1
<option value="2">Skill 2
<option value="3">Skill 3
<option value="4">Skill 4
<option value="5">Skill 5
<option selected="4">Skill 4</option> (or something like that) But what you really want is
<select NAME="Skills">
<option value="1">Skill 1</option>
<option value="2">Skill 2</option>
<option value="3">Skill 3</option>
<option value="4" selected>Skill 4</option>
<option value="5">Skill 5</option>
</select>
Paul
|
|
|
|
|
Where is a good cross reference for all major broswers...?
IE, NS and Opera...???
I came up with a stellar idea for that web dev contest, but I will require a cross reference to properly implement it...
Any sites...?
Thanx.
p.s-Old browser which supported DHTML right up to cutting edge would be great...Mainly IE and Nestacape are my concerns.
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I've always liked the book "The JavaScript Bible." I have the first edition, which doesn't cover Opera, but the newer edition(s) may - I just haven't seen it to verify.
Also, developer.netscape.com is a good start too, but it won't cover Opera.
Jeremy Falcon
Imputek
<nobr>"C# is the answer to a question nobody asked." - Chris Losinger
|
|
|
|
|
Sweet....I figured out a most interesting way of implementing the above, but one thing still gets me...
In NS you have the elements collection for iterating all elements in the document and IE offers the same using the all collection. However getElemenyById was introduced by the W3C to eliminate cross browser incompatibilities(I assume anyways). Does this mean both major browser players will eventually eliminate these collections of theirs in favour of the W3C standard getElementById() ...?
Just curious
Thanx!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
getElemenyById isn't supported in NS 4.7 or below. So if you have that to worry about, you're out of luck.
|
|
|
|
|
if I have the following..
<TD></TD><TD id="Something">Something</TD><TD><IMG/></TD>
How could I get the id of the IMG tag from inside an onMouseOver of the id="something" TD tag...?
IE supports a property called owningElement which I think does something like this...?
Is there any way I can retreive the IMG id ( I want to change the src property ) without supplying the IMG tag an ID also...??
i'm thinking if I could somehow use the all collection:
onMouseOver:
var i = document.all(this.curIndex)+2;
document.all(i).src = "diff.gif"
does something like curIndex exist...?
I would like this to be cross browser...so NS elements collection and IE all collection won't work...
Thanx!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
i want to know the information about this kind of project
suppose there are 100 NIIT centres accross the country and i want to develop a software which would do the billing and details of all the students in these centres accross whole country...i mean info about students and their payments online with clicks...
plz tell me from where to get help or this project ??
thnx
rashmi
|
|
|
|
|
my tables are:
skills: skill(str), skillID(autonumber))
subcategory: subcategory(str), subcategoryid(autonumber), skillID(int)
i am obtaining the value for skill in the string type via a text box(strSkill). however, i need to save this value to the subcategory table as its ID number (ie as an interger value). i am trying to use a SQL statement to derive its related ID, but am failing to do so. where is the problem?
dim sql
sql = "SELECT DISTINCT SkillID FROM Skills WHERE (((Skills.Skill)='" & replace(strSkill,"'","''") & "'))"
Set RS = objConn.Execute(SQL)
If Not bolAlreadyExists Then
RS.AddNew
'adding the new subskill to the table
RS("SubCategory") = Request.Form("SubCategory")
RS("SkillID") = Request.Form("Skills")
'closing the recordset and connection object
RS.Update
RS.Close
thank you!
|
|
|
|
|
Hmmm...ok. Here is a note; you don't need to place DISTINCT in front of SkillID if it is defined as an autonumber and the only field you are selecting (those will always be distinct). If you already have your variable skill defined you should be able to do something like this to get the SkillID:
dim conn
dim rs
set conn = Server.CreateObject("ADODB.Connection")
set rs = Server.CreateObject("ADODB.Recordset")
'if you haven't defined your skill do it here
dim skill, SkillId
skill = replace(Request.Form("skill"), "'", "''")
sql = "SELECT SkillID FROM skills WHERE skill = '" & skill & "'"
conn.ConnectionString = "[.......]"
conn.Open
rs.ActiveConnection = conn
rs.Open(sql)
If Not rs.EOF Then
SkillId = rs("SkillID")
End If
If SkillId = "" Then
'Add New Record Here
End If
rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing
HTH
Nick Parker
|
|
|
|
|
is it possible to pass values between forms when using the Response.Redirect Method?
If (Request("City") = 22) Then
Dim strSkill
strSkill = Request.Form("Skills")
Response.Redirect("add3.asp")
Else.....
in the above code section, i wish to pass the value contained in the "Skills" combo box (located on prev page), but when redirected to the add2.asp form , the value is lost. is there any way to rectify this using VBSCript?
thank you?
|
|
|
|
|
Pass it in the QueryString -
Response.Redirect("add3.asp?skills=" & strSkill)
Then retrieve it using
Request.QueryString("skills")
Paul
|
|
|
|
|
You can do as pd suggests above or do a Server.Transfer("add2.asp") , do remember that you can not create a QueryString with the Server.Transfer method as you can with a Response.Redirect . The advantage of doing a Server.Transfer method is that you can simple request the values you want as if the page posted back to itself, it essentially post all fields from the form over to the page you specify.
Nick Parker
|
|
|
|
|
I've hit a wall.
I'm working with a web-based DataGrid, using Template Columns bound to a dataset.
Once column contains a text box for the Item template and DropDownList for the Edit Template. The Dropdowns are populated from a DataTable within the DataSet being used.
Everything displays properly (i.e. the DDL contains all of the expected values), but upon entering the "edit mode" for a row, the
DropDownList is always set to the FIRST entry!
How can I get the DDL to select the correct value?
Not sure if this will make it more or less clear...
<br />
<asp:TemplateColumn HeaderText='Company Name'><br />
<ItemTemplate><br />
<asp:Label id=Label3 runat='server' Text='<%# DataBinder.Eval(Container,'DataItem.CompanyName') %>'><br />
</asp:Label><br />
</ItemTemplate><br />
<FooterTemplate><br />
<asp:dropdownlist DataSource='<%# GetCompanies() %>' DataTextField='Name' DataValueField='CompanyID' runat='server' ID='cmbFooterCompanyID'><br />
</asp:dropdownlist><br />
</FooterTemplate><br />
<EditItemTemplate><br />
<asp:dropdownlist DataSource='<%# GetCompanies() %>' DataTextField='Name' DataValueField='CompanyID' runat='server' ID='cmbEditCompanyID'><br />
</asp:dropdownlist><br />
</EditItemTemplate><br />
</asp:TemplateColumn><br />
Thanks.
Mike Stanbrook
mstanbrook@yahoo.com
|
|
|
|
|
You need to set the selectedindex property of the dropdownlist.
Todd Smith
|
|
|
|