hypnos
03-19-2008, 12:28 AM
1) Script Title: Dynamic Ajax Content
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm
3) Describe problem: I'm using this code to display external pages, a couple of which have forms for submitting data (guest book application for instance) and the only problem is the postback that occurs taking you away from the main page. The guestbook code is pretty simple, I got it from here http://www.codeproject.com/KB/aspnet/xmlguestbook.aspx .
is there away to submit the data but not postback? Or is there a way to redirect the postback to the main page I have the dynamic ajax content on and possibly go back to the same content in the div (the external guestbook page)?
Here's the button
<asp:button id="btnSubmit" text="Submit" onclick="btnSubmit_Click" runat="server" />
Here's the btnSubmit_Click
Sub btnSubmit_Click(src as Object, e as EventArgs)
PopulateDataSet()
'Add new entry to DataSet
Dim myDataRow As DataRow = myDataSet.Tables(0).NewRow()
myDataRow("datetime") = DateTime.Now()
myDataRow("author") = txtAuthor.Text.toString()
myDataRow("subject") = txtSubject.Text.toString()
myDataRow("comments") = txtComments.Text.toString()
myDataSet.Tables(0).Rows.Add(myDataRow)
'Write to XML
myDataSet.WriteXml(strFilePath, XMLWriteMode.WriteSchema)
DisplayData()
'Clear textboxes
txtAuthor.Text = ""
txtSubject.Text = ""
txtComments.Text = ""
End Sub
In summary - I need a way to control the postback so it redirects and goes to the main page and reloads the external page (called by <a href="javascript:ajaxpage('guestbook.aspx', 'mainContent');">Guestbook</a><BR /> ) or a way to stop the page refresh but still write the data to the xml file and refresh the ajaxpage in the div...
Thanks!
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm
3) Describe problem: I'm using this code to display external pages, a couple of which have forms for submitting data (guest book application for instance) and the only problem is the postback that occurs taking you away from the main page. The guestbook code is pretty simple, I got it from here http://www.codeproject.com/KB/aspnet/xmlguestbook.aspx .
is there away to submit the data but not postback? Or is there a way to redirect the postback to the main page I have the dynamic ajax content on and possibly go back to the same content in the div (the external guestbook page)?
Here's the button
<asp:button id="btnSubmit" text="Submit" onclick="btnSubmit_Click" runat="server" />
Here's the btnSubmit_Click
Sub btnSubmit_Click(src as Object, e as EventArgs)
PopulateDataSet()
'Add new entry to DataSet
Dim myDataRow As DataRow = myDataSet.Tables(0).NewRow()
myDataRow("datetime") = DateTime.Now()
myDataRow("author") = txtAuthor.Text.toString()
myDataRow("subject") = txtSubject.Text.toString()
myDataRow("comments") = txtComments.Text.toString()
myDataSet.Tables(0).Rows.Add(myDataRow)
'Write to XML
myDataSet.WriteXml(strFilePath, XMLWriteMode.WriteSchema)
DisplayData()
'Clear textboxes
txtAuthor.Text = ""
txtSubject.Text = ""
txtComments.Text = ""
End Sub
In summary - I need a way to control the postback so it redirects and goes to the main page and reloads the external page (called by <a href="javascript:ajaxpage('guestbook.aspx', 'mainContent');">Guestbook</a><BR /> ) or a way to stop the page refresh but still write the data to the xml file and refresh the ajaxpage in the div...
Thanks!