Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a repeater in UpdatePanel, and in it is a linkbutton that needs to set some values in a hidden div (display none) and then call javascript method that would make that div visible.

I am using ScriptManager.RegisterStartupScript and it is calling js method but the problem is that the code behind code is overwritten - code behind code is setting values for some fields from database (in the hidden div) and after it appears the fields are empty. If i click on a different button in repeater in updatepanel the div appears with the values set for a previous click. (the customer demand is that they click on a record in repeater and they can change it in a modal dialog).

how can i get the javascript method to make the modal dialog appear with the proper values?

current code is something like this in oncommand event for a repeater linkbutton

  ...
  txtName.Text = row.Name;
  ScriptManager.RegisterStartupScript(this, typeof(string), "showEdit", "showModalPanel('pnEdit')", true);
share|improve this question
    
make sure with whatever the html you update from codebehind is in updatepanel –  sangram parmar Jun 22 '13 at 6:02

1 Answer 1

I recently had some issues with getting ScriptManager.RegisterStartupScript to work with partial postbacks using an UpdatePanel. Try switching your code to use something like this instead...

ScriptManager.RegisterClientScriptBlock(updPnl, updPnl.GetType(), updPnl.ClientID, "alert('hello world';", True)

You also may have to manually update your UpdatePanel on each click so that the hidden div gets the refreshed values. To do this, you'll have to set the UpdateMode on your UpdatePanel to Conditional and then be sure to go back and manually update it whenever you need to in your codebehind.

share|improve this answer
    
it didn't help :( still the same problem –  Rudonja Jun 21 '13 at 19:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.