asp.net 2.0: update formview with jquery

worldcom

New Member
I'm struggling with an issue I just can find a solution for.First of all, I can't use asp.net AJAX or anything else thant standard asp.net 2.0 as the server admin won't install anything else.So here is, what I try to do. (For the curious, skip to the bold question below)My page consists of several parts, each of which gets loaded by jquery.load(url). One of these page parts gets filled with an aspx that contains a form view. As I don't want to have postbacks, I switch to the EditTemplate of the form view by a simple click on a regular html button that submits a parameter indicating the aspx page to switch to edit mode, e.g.\[code\]Page_Load(...){ if(Request.Params["SwitchEditMode"]) SwitchEditMode();}\[/code\]This works perfectly! Now here the part where I'm stuck. The elements in the EditTemplate are based on a select from a database view and bound to the fields by \[code\]<%# Bind("xx")\[/code\]. Then I have a html button (no asp control) that submits a parameter to the aspx page that tells it to invoke the DataSource update method. In the dataSource_updating method I look for the controls that contain the values I want to save. But these values are always the same, as when I switch to the edit view. No changes I make in the textboxes or dropdowns are preserved. A long story short, the question how to save the values from EditTemplate back to the database with jquery?Up to now I tried several approches, that didn't work out.[*]In the updating() method look for the controls by FindControl and set \[code\]e.Command.Parameter["xyz"] = foundcontrol.SelectedValue;\[/code\]. The values are always the same as in the beginning.[*]Set \[code\]<asp:parameter name="SampleValue" />\[/code\] and in the EditTemplate \[code\]<asp:TextBox Value='http://stackoverflow.com/questions/1364570/<%# Bind("SampleValue")#>\[/code\] The values are always null.[*]Set a hidden input field with the selected value via javascript. This doesn't work as the control within EditTemplate are only visible after the switch into edit modeSo maybe I'm totally wrong with my ideas, heading into a totally wrong direction and this can be accomplished much easier, but up to now I don't know how to achieve this. I could do it without ajax, but for the user experience I'd prefer the version with jquery. For all that have read this far and not got confused :-), thanks for your effort!Best regards,Andreas
 
Back
Top