|
Paul Watson wrote:
You going to publish your system so that other people can use it sometime?
That's the plan; once I complete at least a first draft of my website with it. I'll make sure to write an article for CP on it when I do.
-Domenic Denicola- [CPUA 0x1337]
MadHamster Creations
"I was born human. But this was an accident of fate - a condition merely of time and place. I believe it's something we have the power to change..."
|
|
|
|
|
I need to scroll to a link when my page loads.
How could i do it from JavaScript?
rechi
|
|
|
|
|
Bogdan Rechi wrote:
I need to scroll to a link when my page loads.
You'll want to use what's called a named anchor. Let's say this is your link...
<a href="something.html" name="mylink">Clickety</a>
To have the page go directly to it, append a pound sign after the URL followed by the name of the anchor. For instance...
http://www.somepage.com/mypage.html#mylink
It'll go directly to the link.
Now, to force that without having to type in the pound sign, etc. you could use one of many techniqes, but I'll focus on two.
In JavaScript...
<body ... onLoad="location.href += '#mylink';">
In a client-side redirect...
<head><br />
<meta http-equiv="refresh" content="0;URL=mypage.html#mylink"><br />
</head>
Jeremy Falcon
Imputek
<nobr>"..." - Paul Watson 07-17
|
|
|
|
|
In JavaScript...
That was all i've needed. And i promise: no more link s for anchor s!
Thanx for your effort.
rechi
|
|
|
|
|
I am trying to get a datagrid to update. Everything else
in it works. However when I try to retrieve the new value
it passes me the original value. Any Ideas? Thanks.
public void UpdateGrid(object sender, DataGridCommandEventArgs e)
{
UpdateVendor.Connection = Global.sqlConnection;
UpdateVendor.Parameters[0].Value = dgVendors.DataKeys[(int)e.Item.ItemIndex];
UpdateVendor.Parameters[1].Value = ((TextBox)e.Item.Cells[3].Controls[0]).Text;
UpdateVendor.Parameters[2].Value = ((TextBox)e.Item.Cells[4].Controls[0]).Text;
UpdateVendor.Parameters[3].Value = ((TextBox)e.Item.Cells[5].Controls[0]).Text;
UpdateVendor.Parameters[4].Value = ((TextBox)e.Item.Cells[6].Controls[0]).Text;
UpdateVendor.ExecuteNonQuery();
dgVendors.EditItemIndex = -1;
dgVendors.DataBind();
Response.Redirect("ManageVendors.aspx");
}
Steve
Not all who wander are lost...
|
|
|
|
|
Still can't get it? Did you read the article?
|
|
|
|
|
I read your article several times. Do I have explicitly have all the items be textboxs? Do I have to process the Textboxs OnTextChanged message even if I just want the end result? If the arguements passed are the original values what use is the update command? Thanks.
Steve
Not all who wander are lost...
|
|
|
|
|
a couple of points...
1. you are using a global sqlconnection....this could hog resources...i'd at least try to close it after every use and reopen it before every use...the datagrid is good at displaying disconnected data (that's that the System.Data.DataSet object is)
2. make sure you aren't calling DataBind() in your page_load event every time, or else it'll grab the data right from sql again
should be something like
public void page_load()
{
if (!Page.IsPostBack)
{
Page.DataBind();
}
else
{
//do nothing...page was posted back, and data will remain in datagrid unless changed in another function
}
}
hope this helps
michael griffith
--------------------
mgriffith@lauren.com
mdg12@po.cwru.edu
|
|
|
|
|
Here is what I am doing to create an sql statement to query my database and return records displaying them as a bulleted list:
1.<%
2.Set catRS = Server.CreateObject( "ADODB.Recordset" )
3.catRS.ActiveConnection = Con
4.sqlString = "SELECT DISTINCT product_category FROM Products "
5.sqlString = sqlString & "WHERE product_status=1 "
6.sqlString = sqlString & "ORDER BY product_category "
7.catRS.Open sqlString
8.%>
9.<% If cat = "Home" THEN %>
10.Home
11.
12.<% ELSE %>
13.Home
14.<% END IF %>
15.<% WHILE NOT catRS.EOF %>
16.<% IF catRS( "product_category" ) = cat THEN %>
17.
18.<%=catRS( "product_category" )%>
19.
20.<% ELSE %>
21.- "><%=catRS( "product_category" )%>
23.<% END IF %>
24.<%
25.catRS.MoveNext
26.WEND
27.%>
28.
29.<% catRS.Close %>
And I receive this error message when trying to open up the default.asp page that includes this catlist.asp file to populate a menu:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E0C)
Command text was not set for the command object.
/cham2DSN/catlist.asp, line 7
Can anyone give me any clues???
|
|
|
|
|
You might want to try that again, and check the "display as-is" box
--
Help me! I'm turning into a grapefruit!
|
|
|
|
|
Ok, here is my go at it, it does appear to be a little jumbing as ben said before.
Do something like this:
<%
Dim conn
Dim catRS
Dim sql
With Response
Set conn = Server.CreateObject("ADODB.Connection")
Set catRS = Server.CreateObject("ADODB.Recordset")
sql = "SELECT DISTINCT product_category FROM Products " & _
"WHERE product_status=1 ORDER BY product_category"
conn.ConnectionString = <code>[YourConnectionStringGoesHere]</code>
conn.Open
catRS.ActiveConnection = conn
catRS.Open sql
If Not catRS.EOF Then
.Write "<ul>" & vbcrlf
Do Until catRS.EOF
If catRS("product_category") = <code>"SomeWord"</code> or <code>Variable</code> Then
.Write "<li>" & catRS("product_category") & "</li>"
End If
catRS.MoveNext
Loop
.Write "</ul>"
End If
catRS.Close
set catRS = nothing
conn.Close
set conn = nothing
End With
%>
HTH
Nick Parker
|
|
|
|
|
3.catRS.ActiveConnection = Con
Where do your "Con" come from?
|
|
|
|
|
I am wondering how (if it is possible) to do the following:
You have a login form with a login ID (email address) and a password. When the user clicks the "Submit" button, go to a page that varifies the email address and password. That part I've got done -- easy.
What I would like is to have another button, or a link, that will go to a different page that will send the user their password in an email. So what I'm wondering is how can this other page (the one sending the email) get the email address the user entered on the form? I would rather not simply redirect them to a second page where they enter the email address. If possible, I would like to be able to read the email address entered on the login form. Can it be done? If so, how?
My understanding is that the data on the form is not available to subsequent pages until the form is submitted (which activates the "action" page, right?). Is there a way around that, or am I missing something basic?
Thanks.
|
|
|
|
|
<form action="original.html" method="post">
<input type="text" name="email">
<input type="password" name="passwd">
<input type="submit" value="OK">
<input type="button" value="Forgot Passowrd" onClick="this.form.action='newpage.html';this.form.submit();">
</form>
Jeremy Falcon
Imputek
<nobr>"..." - Paul Watson 07-17
|
|
|
|
|
It works like a charm.
That's excellent. Thanks.
|
|
|
|
|
David Fleming wrote:
I would rather not simply redirect them to a second page where they enter the email address. If possible, I would like to be able to read the email address entered on the login form. Can it be done? If so, how?
Jeremy's way works well, but an alternative (always good to have options) is to have the FORM still go to the same handling ASP page, but also have a hidden text box in the FORM which tracks which button was clicked.
Then in the ASP you can check which one was clicked and do whatever is appropriate.
The benefit is that you can save some coding by having only one ASP page and not two. The down side is there is a bit more code (HTML and JavaScript) on the originating FORM page.
If you need some help with the hidden text box method just ask...
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
The greatest thing you'll ever learn is just to love, and to be loved in return - Moulin Rouge
Alison Pentland wrote:
I now have an image of you in front of the mirror in the morning, wearing your knickers, socks and shoes trying to decided if they match!
|
|
|
|
|
Ah, good idea.
I've already coded it the other way, but thanks for the alternative. I agree, always good to have alternatives.
I've used hidden text boxes but didn't even think of that.
|
|
|
|
|
|
In theory, very similar to the first reply I got, in that you change the ".action" to the new page. But very slick. I also liked the idea one person, who wrote a message on the article's page, had about having a single function that takes a parameter that tells it which page to redirect to. Very nifty.
Thanks everyone.
|
|
|
|
|
Yes - the guy "Mr Picky" is a mate of mine who wrote just to let me know that my code was messy and unweildy (What are friends for, eh? )
cheers,
Chris Maunder
|
|
|
|
|
i need to detect carrige resturns, and replace them with < b r >, thet text will of couse be entered into a text area in a form.
the technolodies i have at my disposal, are Javasciprt and PHP, does anyone know if this is possible?
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
never mind people, i found a function in PHP, the nl2br() function.
to use it, simply do
nl2br("this\nstring\nhas\nreturns");
and it turns the \n into <br>
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
Nnamdi Onyeyiri wrote:
and it turns the \n into <br>
Just an FYI...
\r\n = Windows (not in textareas, but in text files)
\n = Unix\Linux\Posix, etc.
\r = Macintosh
Jeremy Falcon
Imputek
<nobr>"..." - Paul Watson 07-17
|
|
|
|
|
|
This information really depends on what you are doing, but I first came across this issue when developing a website on a PC using PHP for a client using mainly Macs.
I was using my own API; however, and not nl2br() because it didn't provide enough functionality. I'm not sure if nl2br() will handle carriage returns and line feeds instead of just line feeds. I'll have to check I guess.
Jeremy Falcon
Imputek
<nobr>"..." - Paul Watson 07-17
|
|
|
|