|
|
Hi, have following situation:
Using a dropdownlist with sqldatasource as source for selectedvalue and objectdatasource as source for the listitems.
I have added 1 item to the dropdownlist in the aspx page. It doesn't show up on the page though. I'm guessing the databind clears the listitems, but where is the best place to put it then?
If I get a null value from the sqldatasource, I need to select the manually added item. If not, I need to select an item from the databound listitems. Of course, if the manually added item stays selected, I need to return that null value back to the sqldatasource for insert/update. Guessing that last part needs to be done in the inserting/updating eventhandler of the sqldatasource, but otherwise, I'm not really sure what to do.
Using the customized dropdownlist I got from the Microsoft website(Customized Dropdownlist), I have fixed the problem that an exception was thrown every time I tried to select the manually inserted item, but it doesn't show on the page.
Anyone care to help me out here?
Thanks.
|
|
|
|
|
Mixing Data binding and custom elements in a Dropdown is always an headache. If the Data source is a DataTable, you can add your manual entry into the table as a row before the data binding process. Add it as the first item and you can write custom logic to handle this special case based on the index of the item selected.
|
|
|
|
|
Figured out the problem: I had disabled the inserted item. Anyone know though if you can enforce the user to select a different item other than disabling it?
|
|
|
|
|
I have a chart control in my ASPX page. At the top of the page there are some dropdown boxes to select some parameters to draw chart control and a button. Initially the chart control is invisible. After the btton click the chart control databinding will be done and visible property is set true. How to make the Chart control to be focused where it is at the down of the page after button click. Where now after postback the user has to scroll down to view the chart.
|
|
|
|
|
|
These links show when we have a hyperlink.. but i have to do it when postback i.e inside a button click event handler..
|
|
|
|
|
|
If I remember correctly,
the button click event fires a postback to the server, the page is sent to the server
background processing occurs on the server, here you can toggle the visible property
the page is sent back to the client, and then the page loads again with new HTML
the page.load event fires again
so the focus should probably be in the page.load event,
if page.ispostback {
if yyy.visible = true {
xxx.focus
}
}
try that out.
|
|
|
|
|
After working with C# for a few years now, i'm thinking about to switch my web development branch to .NET as well. But old habits die hard, and i find it very hard to do the switch. Especially considering the PHP codebase i leave behind.
So the question is, is there any good material, tips, guides, tutorials and so on, for an old PHP egghead like me?
|
|
|
|
|
At today's rapid pace of technological advancement, it is necessary to be versatile. Learning new technology does not have to be at the expense of abandoning an existing one as long as it is still relevant. Take it as an add-on, and the knowledge and experience that you have acquired for PHP should give an advantage as you would have understand how the web work and you would already have the competency in solving problem using code. It is only a matter of learning a new language and a new paradigm of coding, but one thing never change, that is your ability to solve problems using code (as you already have), albeit a different one.
To get started, try this: Learn About ASP.NET Web Forms[^]
|
|
|
|
|
I don't think i will abandon PHP anytime soon, but i will slowly, but surely shift over to ASP.NET. That's why i want to start as soon as possible to learn all the stuff that is required to produce a working web application, with the same quality standards i have for my PHP based applications.
|
|
|
|
|
|
Thanks
But Phalanger looks like the dirty way into ASP.NET!?
|
|
|
|
|
That's why mentioned as "Offtopic" there. Some people don't want to move quickly to new things so suggested that one.
BTW I forgot to mention one more useful link.
Beginner's Walk - Web Development[^]
|
|
|
|
|
That is exactly what i was looking for. Thank
|
|
|
|
|
I made the switch 7 years ago. Last year I took up PHP again, took a week to get use to it again, learn the new rules and terms. Actually my knowledge of ASP.Net made me a better PHP programer, at least I think.
With asp.net, you have to declare primitive values for everything, actually you have to declare everything, it's not like PHP where it sort of just assumes. And always check that the value exist first, or else you'll throw an exception.
Just remember that and coding should be sort of similar.
Most of the principles are the same, Just worded different. Just keep Google handy to search for comparisons. That what I did for going back to PHP.
I took up PHP again because there are so many little cash jobs out there for it in my area, and the jobs are so easy to do and take little time to complete.
|
|
|
|
|
first I made "connection.asp"
the codes in "connection.asp" file are as follows
<%
Dim conn
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "Provider=SQLOLEDB; Data Source = (local); Initial Catalog = Test; User Id = sa; Password=as"
If conn.errors.count = 0 Then
Response.Write "Connected OK"
End If
%>
then I made "author.asp". The following code are in "author.asp"
<title>
AuthorID
Author Name
<%
dim aid,aname,objs
aid=Request.form("aid")
aname=Request.form("aname")
Set objdb=conn()
query = "INSERT INTO author (aid,aname) VALUES ('"& aid &"','"& aname &"')"
Set objs = objdb.Execute(query)
Response.Redirect ("thankyou.asp")
%>
the code can't run. I think, there may be error in "author.asp". So, Plz help me
|
|
|
|
|
i dont understand that Conn()
first you try this below code in one page, and if run sucessful then sperate connection on second page.
<%
dim Conn
set Conn = Server.Createobject("ADODB.Connection")
Conn.ConnectionString = "PROVIDER=SQLOLEDB;DATA SOURCE=yourMachine\SQLEXPRESS;UID=sa;PWD=whatever;DATABASE=DB;"
Conn.Open
Dim MyRs
Set MyRs = Server.CreateObject("ADODB.Recordset")
MyRs.CursorLocation = 3
Dim vAuthorID, vName,sql
vAuthorID = Request.Form(txtid)
vName = Request.Form(txtName)
sql="Insert into author(aid,aname) VALUES ('"& vAuthorID &"','" & vName &"')"
conn.Execute(sql)
conn.close
set sql = Nothing
response.Redirect("thankyou.asp")
End If
%>
Let me know if it helps
|
|
|
|
|
<title>
AuthorID
Author Name
<%
dim Conn ' As Object
set Conn = Server.Createobject("ADODB.Connection")
Conn.ConnectionString = "Provider=SQLOLEDB; Data Source = (local); Initial Catalog = Test; User Id = sa; Password=as"
Conn.Open 'an error will occur here if the server/connection info is incorrect.
Dim MyRs 'As ADODB.Recordset
Set MyRs = Server.CreateObject("ADODB.Recordset")
MyRs.CursorLocation = 3 'adUseClient
Dim vAuthorID, vName,sql
vAuthorID = Request.Form(aid)
vName = Request.Form(aname)
' --note this is wide open to SQL injection better to use StoredProcedure instead:
sql="Insert into author(aid,aname) VALUES ('"& vAuthorID &"','" & vName &"')"
conn.Execute(sql)
conn.close
set sql = Nothing
response.Redirect("thankyou.asp")
End If
%>
Hello fri, plz look at my code. Error still happen in my code. Thz
|
|
|
|
|
|
No error was found but I need to encrypt one field (e.g - password). How should I do with Classic ASP?
|
|
|
|
|
Ye Htut wrote: but I need to encrypt one field (e.g - password). How should I do with Classic ASP? Check this article
Encrypting Passwords in ASP[^]
If possible get rid of Classic ASP. Go with ASP.NET
|
|
|
|
|
SubjectUserSid S-1-5-21-3532193094-2589986628-862158326-1002 how do i find the name that goes with this #?
|
|
|
|
|