开发者

DetailsView / UpdatePanel question

开发者 https://www.devze.com 2023-03-23 08:06 出处:网络
I have a DetailsView grid inside of an UpdatePanel.When the DetailsView is开发者_C百科 in Edit mode and the \"Save\" button is clicked, while the update is happening, I\'d like the text of the \"Save\

I have a DetailsView grid inside of an UpdatePanel. When the DetailsView is开发者_C百科 in Edit mode and the "Save" button is clicked, while the update is happening, I'd like the text of the "Save" button to change to "Saving...", and when the update is complete I'd like the text of the button to change to "Saved".

How is this done? I can find the current text of the button with:

Button btnSave = (Button)DetailsView1.Rows[12].Cells[0].FindControl("Button1");

However, when I put the following in DetailsView1_ItemUpdating:

btnSave.Text = "Saving...";

And the following in DetailsView1_ItemUpdated:

btnSave.Text = "Saved";

The button text is not updating at all during the save and after the save is complete. What am I doing wrong? Does the UpdatePanel not automatically update as a result of the Text change?


You'll have to do "Saving..." with client script and then set "Saved" from server side code because DetailsView1_ItemUpdating and DetailsView1_ItemUpdated usually occur on the same postback and you will never see "Saving..." caption.

Try

<asp:Button onClientClick="this.value='Saving...'" ... />

and do

btnSave.Text = "Saved";

in DetailsView1_ItemUpdated like you are doing right now.

0

精彩评论

暂无评论...
验证码 换一张
取 消