Connecting Tech Pros Worldwide Forums | Help | Site Map

XML question

Aaron
Guest
 
Posts: n/a
#1: Jan 5 '06
Hello,

I am using VB/ASP.net 2005. When I click submit it refreshes the page
without entering the data from all the text boxes and not entering in the
Game1.xml.

here is the asp.vb code
Imports System.Xml

Partial Class _game1

Inherits Web.UI.Page

...............

Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnSubmit.Click

Dim xDoc As New XmlDocument

xDoc.Load(Request.MapPath("game1.xml"))

Dim newComment As XmlDocumentFragment = xDoc.CreateDocumentFragment()

newComment.InnerXml = "<Game>" + _

"<Wname>" + Server.HtmlEncode(txtWName.Text) + "</Wname>" + _

"<Bname>" + Server.HtmlEncode(txtBName.Text) + "</Bname>" + _

"<date>" + Server.HtmlEncode(txtDate.Text) + "</date>" + _

"<opening>" + Server.HtmlEncode(txtOpening.Text) + "</opening>" + _

...........

...........

...........

"</Game>"

Dim root As XmlElement = xDoc.DocumentElement

root.AppendChild(newComment)

xDoc.Save(Request.MapPath("game1.xml"))

Response.Redirect(".....")

End Sub

.........

End Class



TIA



Peter Rilling
Guest
 
Posts: n/a
#2: Jan 5 '06

re: XML question


Because you are doing a redirect. By doing this, the browser does not
remember what was last submitted because as far as it is concerned, it is a
new page, just like as if you entered the URL directly in the address bar.

"Aaron" <fromtheweb@aaronminoo.com> wrote in message
news:uickLdcEGHA.532@TK2MSFTNGP15.phx.gbl...[color=blue]
> Hello,
>
> I am using VB/ASP.net 2005. When I click submit it refreshes the page
> without entering the data from all the text boxes and not entering in the
> Game1.xml.
>
> here is the asp.vb code
> Imports System.Xml
>
> Partial Class _game1
>
> Inherits Web.UI.Page
>
> ..............
>
> Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles btnSubmit.Click
>
> Dim xDoc As New XmlDocument
>
> xDoc.Load(Request.MapPath("game1.xml"))
>
> Dim newComment As XmlDocumentFragment = xDoc.CreateDocumentFragment()
>
> newComment.InnerXml = "<Game>" + _
>
> "<Wname>" + Server.HtmlEncode(txtWName.Text) + "</Wname>" + _
>
> "<Bname>" + Server.HtmlEncode(txtBName.Text) + "</Bname>" + _
>
> "<date>" + Server.HtmlEncode(txtDate.Text) + "</date>" + _
>
> "<opening>" + Server.HtmlEncode(txtOpening.Text) + "</opening>" + _
>
> ..........
>
> ..........
>
> ..........
>
> "</Game>"
>
> Dim root As XmlElement = xDoc.DocumentElement
>
> root.AppendChild(newComment)
>
> xDoc.Save(Request.MapPath("game1.xml"))
>
> Response.Redirect(".....")
>
> End Sub
>
> ........
>
> End Class
>
>
>
> TIA
>
>[/color]


Aaron
Guest
 
Posts: n/a
#3: Jan 5 '06

re: XML question


Pter,

I have tried with out the redirect and it still will not input data from all
the textboxes.

Aaron


"Peter Rilling" <peter@nospam.rilling.net> wrote in message
news:Ocd1fKfEGHA.2036@TK2MSFTNGP14.phx.gbl...[color=blue]
> Because you are doing a redirect. By doing this, the browser does not
> remember what was last submitted because as far as it is concerned, it is[/color]
a[color=blue]
> new page, just like as if you entered the URL directly in the address bar.
>
> "Aaron" <fromtheweb@aaronminoo.com> wrote in message
> news:uickLdcEGHA.532@TK2MSFTNGP15.phx.gbl...[color=green]
> > Hello,
> >
> > I am using VB/ASP.net 2005. When I click submit it refreshes the page
> > without entering the data from all the text boxes and not entering in[/color][/color]
the[color=blue][color=green]
> > Game1.xml.
> >
> > here is the asp.vb code
> > Imports System.Xml
> >
> > Partial Class _game1
> >
> > Inherits Web.UI.Page
> >
> > ..............
> >
> > Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As
> > System.EventArgs) Handles btnSubmit.Click
> >
> > Dim xDoc As New XmlDocument
> >
> > xDoc.Load(Request.MapPath("game1.xml"))
> >
> > Dim newComment As XmlDocumentFragment = xDoc.CreateDocumentFragment()
> >
> > newComment.InnerXml = "<Game>" + _
> >
> > "<Wname>" + Server.HtmlEncode(txtWName.Text) + "</Wname>" + _
> >
> > "<Bname>" + Server.HtmlEncode(txtBName.Text) + "</Bname>" + _
> >
> > "<date>" + Server.HtmlEncode(txtDate.Text) + "</date>" + _
> >
> > "<opening>" + Server.HtmlEncode(txtOpening.Text) + "</opening>" + _
> >
> > ..........
> >
> > ..........
> >
> > ..........
> >
> > "</Game>"
> >
> > Dim root As XmlElement = xDoc.DocumentElement
> >
> > root.AppendChild(newComment)
> >
> > xDoc.Save(Request.MapPath("game1.xml"))
> >
> > Response.Redirect(".....")
> >
> > End Sub
> >
> > ........
> >
> > End Class
> >
> >
> >
> > TIA
> >
> >[/color]
>
>[/color]


PJ on Development
Guest
 
Posts: n/a
#4: Jan 5 '06

re: XML question


Dear Aaron,

Looks like you're saving the input in an XML file.

Did you check to see if the ASP_NET (or the NETWORK_SERVICES if you're
running Win2K3) account has permission to write on that file?

If it does have permission, check the contents of the file and it
should be there.

If you plan to redirect the process to another page, make sure to pass
all the values to the other page.

Regards,

PJ
http://pjondevelopment.50webs.com/

Aaron
Guest
 
Posts: n/a
#5: Jan 5 '06

re: XML question


Pj,

Thanks for the info, it was permission.
"PJ on Development" <pjondevelopment@gmail.com> wrote in message
news:1136477679.291081.83470@o13g2000cwo.googlegro ups.com...[color=blue]
> Dear Aaron,
>
> Looks like you're saving the input in an XML file.
>
> Did you check to see if the ASP_NET (or the NETWORK_SERVICES if you're
> running Win2K3) account has permission to write on that file?
>
> If it does have permission, check the contents of the file and it
> should be there.
>
> If you plan to redirect the process to another page, make sure to pass
> all the values to the other page.
>
> Regards,
>
> PJ
> http://pjondevelopment.50webs.com/
>[/color]


Closed Thread


Similar Visual Basic .NET bytes