|
|
Hi,
I am developing web app and:
I have a text box and a drop down list.If i enter a data into the text box i've to show the new entry in the dropdown list at that time itself.If i refresh the page i could see the change ,but is there any other way?
Help me.
|
|
|
|
|
Subin Alex wrote: .If i enter a data into the text box i've to show the new entry in the dropdown list at that time itself.If i refresh the page i could see the change ,but is there any other way?
I didn't get your question.
My understanding is that,You have one textbox and a dropdown list, You are entering some data in textbox and you want some data will be populated to dropdown list. Is it correct?
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
|
Then why you are not using AJAX.
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
is the data u enter go in database.
If yes Ajax is the way
If no use javascript or ne client side scripting.
|
|
|
|
|
What a strange reply. Why is AJAX required ? If the data was not going into a database, how would his question make sense ? How is AJAX different to javascript ?
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Not sure why no-one else was able to answer this. page_load fires before events, page_prerender fires after. Sounds like your events update the data source, but you load the data to your drop down list in page load, so the old data is loaded, then the data gets updated. Move your code to page_prerender so you load it AFTER you update it. AJAX has nothing to do with it.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
You should use AJAX to call data from your database. Javascript to trigger the call to a servlet that talks to your DB. If you don't have too much data it will be fast enough as is. If you havea large database and it's too slow, you can use an external DB indexing server of some sort. Example:
[^]
Good luck,
Dan - rastaquere AATT gmail DOOTT com
|
|
|
|
|
|
shantanusenin wrote: Urgent
I'll get back to you in my leisure time.
shantanusenin wrote: I am trying open a excel file after downloading it from website
Use Excel to open it it
shantanusenin wrote: but its giving error "Missing file: C:\default.css?5".how can i overcome the error thru C#.
what
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
shantanusenin wrote: I am trying open a excel file after downloading it from website, but its giving error "Missing file: C:\default.css?5".how can i overcome the error thru C#.
After download you are not able to open the file, then how asp.net comes into the picture?
Are you downloading the file from your application or you are generating the File and download it from your sites
shantanusenin wrote:
Urgent
Nothing urgent for me
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
You are an idiot.
Why would an excel file require a css file ? Where are you getting this error, in a web page ? What is this file, did you create it ? All sorts of things you could tell us which might mean we could actually help you. Even tho it's not urgent to us at all.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
I applied following code. Output show Msg sent successfully. Actually never it is sent to destination. Messages are only push to C:\inetpub\mailroot\queue;
1.I think IIS can not push the emails out on the internet.How can I look on SMTP response code.
2.I want to send emails from localhost. Now I confused how it possible sending a mail from anonymous mail address like "shahdat_mbstu@yahoo.com" through localhost, bcoz there no relation between my localhost and my mail address "shahdat_mbstu@yahoo.com". ;
3. Please help me!;
public void CreateCopyMessage(string server)
{
MailAddress from = new MailAddress("shahdat_mbstu@yahoo.com", "Ben Miller");
MailAddress to = new MailAddress("shahdat45ict@yahoo.com", "Shahdat Kooras");//jane@contoso.com
MailMessage message = new MailMessage(from, to);
// message.Subject = "Using the SmtpClient class.";
message.Subject = "Using the SmtpClient class.";
message.Body = @"Using this feature, you can send an e-mail message from an application very easily.";
// Add a carbon copy recipient.
MailAddress copy = new MailAddress("Notification_List@contoso.com");
message.CC.Add(copy);
SmtpClient client = new SmtpClient(server);
// Include credentials if the server requires them.
client.Credentials=
client.Credentials = CredentialCache.DefaultNetworkCredentials;
Console.WriteLine("Sending an e-mail message to {0} by using the SMTP host {1}.",
to.Address, client.Host);
try
{
client.Send(message);
lblMessage.Text = "Message successfully sent";
}
catch (Exception ex)
{
Console.WriteLine("Exception caught in CreateCopyMessage(): {0}",
ex.ToString());
}
}
shahdat
|
|
|
|
|
check the event log for errors. That should give you a hint as to what is going on.
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
|
My web site uses a master page developed by a consultanting company, in which a custom control generates a session variable Session["Url"] that keeps the Url of the current page. After visiting several pages (all uses the same master page, Url1, Url2.....), I display the value of the Session["Url"] on my testing page that does not use the master page with one line of code:
Response.Write(Session["Url"].ToString());
It displays the last Url I visited. However, when I refresh this page continuously, I see a different value each time for all the pages I visited. Why does one session variable keeps multiple values? I could not duplicate this behavior with my own pages by assigning different values to Session["Url"] multiple times. It always stores the last value I assigned. Does anyone know why? This has created a big problem for me because the Session["Url"] is used to redirect a user back to where he comes from after login.
Thanks,
TOMZ_KV
|
|
|
|
|
Tomz_KV wrote: Why does one session variable keeps multiple values?
It does not. You have answered your own question in the next statement.
Tomz_KV wrote: I could not duplicate this behavior with my own pages by assigning different values to Session["Url"] multiple times.
check all the places where Session["Url"] is set. Since you are using the Master page which is developed by others, I am suspecting it being set somewhere else. I'd set a break point where the session variable is set and see what is happening.
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Thanks for your reply.
I can't see the code in the custom control on the master page since it was compiled. My understanding is that no matter where Session["Url"] is set and how many times it is set, it should have only one value - the latest one. AS I said, when I displayed this variable on my testing page, every refresh showed a different value.
TOMZ_KV
|
|
|
|
|
I finally duplicated the behavior. By the way, the web application use InProc session state. Here is the process:
Session["Url"] value changed - I browse several pages that use the master page. Session["Url"] is set on each page I visited. Then I go to my testing page that DOES NOT use a master page to display the Session["Url"]. With each refresh of the testing page, I see a different value of the Session["Url"].
Session["Url"] value not changed - Code the testing page using the same master page. Go through the above steps. With each refresh of the page, Session["Url"] value is the same which is the Url of the current testing page.
This is very interesting. I could not found any documentation that explains this. Is this a designed behavior for asp.net?
TOMZ_KV
|
|
|
|
|
I can I detect if any textbox text values have changed before I commit the changes to the database?
|
|
|
|
|
In Javascript you can compare the object's "value" property with its "defaultValue" property.
Alternatively on the server you can have an object that has the value set on Page_Load or similar, and then on Postback you can compare whats in the Textbox with what your object's value is.
|
|
|
|
|
Which method is the preferred way of doing it and the least taxing on the server? I have 30 textboxes on the page.
|
|
|
|
|
Well I dont know enough about your situation to make that call. You could even do it at the database level if you are using stored procedures, but in most cases thats probably not a good idea.
Also what are you trying to accomplish specifically? If you dont want the user changing stuff why not just make the fields readonly?
If you have a specific reason why not and in a situation where you are already loading data from a database during a request, keeping it in a session object, and then showing that data to a user in a textbox, then on postback you will already have that data on your server and won't need to go back to the database to do your comparison, the original data is already there on the server. Personally I think it would be best practice to check it on the server. Since either way you are going to be testing equality on some field (be it a string or a changed-flag).
Are you validating any other fields on the page with javascript? Then you could lump your comparison in there with the validation, but then you'd need to create hidden fields and it might be too complex and not worth the small performance gain you would get when substituting a string compare with the changed field bool.
Sorry for rambling 
|
|
|
|
|
The senerio I have is pretty simple. If the user makes any changes to the data in the textboxes on the page the logic that updates the database needs to update one of the table fields with a 0 otherwise use the existing value. Hence, I need to check if any changes were made on the page.
From what I have read using a session varable to store datatable rows is a server resource hog so instead I requery the database each time I need to.
And no I am not validating fields on the page with javajscript. Instead I have a class method to do the validating.
So to check if a user changed data on the page I should use some javascript?
|
|
|
|