Showing posts with label values. Show all posts
Showing posts with label values. Show all posts

Wednesday, March 28, 2012

Update textbox value

Dear friends,


I'm trying to update a textbox value by values that occour in a for each statement.
Ex.:

List<string> words = new List<string>();
words.Add("Test1<br>");
words.Add("Test2<br>");
words.Add("Test3<br>");
words.Add("Test4<br>");
words.Add("Test5<br>");

foreach (string s in words)
{
txtOcorrencias.Text += s;
System.Threading.Thread.Sleep(2000);
}

I want that each word appear for time, but when the function runs, all the words at the same time.

How I code this?

It's because you are doing this on the server. The server doesn't return the page to the browser every time it sleeps. It runs all of the code and then renders the page.

Have you considered doing this in javascript?


Yes, I try to use javascript but I used Thread to simulate other methods that the application have to execute on the server.


This is one way of doing it:http://encosia.com/2007/10/03/easy-incremental-status-updates-for-long-requests/


gt1329a

I'm using the code you recommend to me, It works 100%.

Thanks.

Update the gridview by using AJAX.

Hi,

Can anyone help me regarding update data in the gridview by using AJAX. Once enter the values textboxes and saved into Database, then gridview has to update the new changes. I am using C#.

Pls help me to know about this.

Thank you.

Call the Update method of the UpdatePanel which contains the GridView programmatically after you save values to the database.

...// Save to database

UpdatePanel1.Update();

Thanks

Monday, March 26, 2012

UpdatePanel (Ajax) with DetailView

Hi All:

I have an UpdatePanel(Ajax) and inside one DetailView. When I try to insert a new record in the DetailView the new values are "" (null) . I don't know what I am doing wrong. He re is part of my code for get the values from the DetailView

protected

void DetailsView1_ItemInserting(object sender,DetailsViewInsertEventArgs e)

{

TextBox txtRow_MasterCustId = ((TextBox)DetailsCustomerMaster2.FindControl("TextBox0")); // The values are ""TextBox txtMaster_CustomerId = ((TextBox)DetailsCustomerMaster2.FindControl("TextBox1")); // The values are ""

ObjectDatacustomerMasterDetails.InsertParameters[1].DefaultValue = txtMaster_CustomerId.Text;

ObjectDatacustomerMasterDetails.InsertParameters[2].DefaultValue = txtCustomer_Name.Text;

}

I appreciate any help

thanks

Can you please elaborate on the problem. What I understand is briefly as

Problem Identified As: That when you insert a null value, it does not get inserted into the database.

Solution: Check your database fields first. If nulls are not accepted, then this problem could possibly arise.

Problem Identified As: Even if you insert data, only nulls are inserted.

Solution: This could be possibly because of the queries that are associated with the detailsview. Happens when you've not specified the fields properly in the queries.

Please reply if what I've understood was right and if they solved your problem. Else elaborate more on the problem to clarify what the problem actually is. It is not clear with your message.

Enzoi!!!


The problem is that when I click the Insert button in the DetailView ( the DetailView is in Insert Mode), the values that holds the textboxes are empty. The user typed some values to each textbox in the Detailview for Insert a new record. I try to get the new values inserted by the user before the inserting but there are not values.

protected

void DetailsView1_ItemInserting(object sender,DetailsViewInsertEventArgs e)

{

TextBox txtRow_MasterCustId = ((TextBox)DetailsCustomerMaster2.FindControl("TextBox0")); //The textbox is empty but the user inserted some textTextBox txtMaster_CustomerId = ((TextBox)DetailsCustomerMaster2.FindControl("TextBox1"));TextBox txtCustomer_Name = ((TextBox)DetailsCustomerMaster2.FindControl("TextBox2"));

ObjectDatacustomerMasterDetails.InsertParameters[1].DefaultValue = txtMaster_CustomerId.Text; //The textbox is empty but the user inserted some text so the parameter are empty

ObjectDatacustomerMasterDetails.InsertParameters[2].DefaultValue = txtCustomer_Name.Text;

ObjectDatacustomerMasterDetails.InsertParameters[3].DefaultValue = txtAddress.Text;

}

If I put the DetailView outside of the update panel , it works. I can get the new values and the parameters are fine in the InsertParameter

but if it is inside of the update panel is not working. I can't get the new values and the parameters are empty. Why the differences ?

Thank you for any help.


Have you found any solution?

I'm having the same problem except from the fact that I'm not using any Ajax. My program was working fine, but after integrating with some design (pics and CSS, ...etc) the TextBoxes are always empty when submitting a page, even if the user writes things in there. The textboxes are found in the code-behind page (not null, but do exist) However their .Text value is always an empty string no matter what the user writes in them.


No I don't have a solution ?

I am waiting that somebody can help me.

Wednesday, March 21, 2012

UpdatePanel and focus

I Have a lot of textbox inside a updatepanel and when the text of one textbox changed, I refresh the values of each textbox.

The problem is that I lost the focus when the controls get the new values. I want the focus in the next control.

Set the focus by calling the SetFocus method of the ScriptManager object.


Thanks for the response.

Its works very well


Doesn't work for me when I try to set focus to a RadiobuttonList inside an updatepanel?

updatepanel and pagesource in browser

I have an updatepanel with a gridview
The paging works perfect.

When I view the pagesource when Im on page 1 in the gridview I can see the values that are displayed to the end-user (for example username, age and some user comment)
When I go to the second page, the end-user can see the values in the gridview as intended, but when I view the page source I cant find the displayed values.

So where does this text actually reside? Im used to that in the pagesource I can always view what is displayed to the end-user.


Hello,

most browsers will show you the page source as it was the first time you loaded the page. With Ajax you are changing parts of the page after it has loaded. If you want to get real insight into the changes try theFirebugadd-on for Firefox. It will show you the page source in a nice collapsible treeas it is, live. Also, you can use it to check out the communication to and from the server during an Ajax call and much much more.

Good luck!