I am a bit of a newbie and this is a trickier bit of .net. What you =
suggested worked to a certain extent. You were right I wasn't using the =
viewstate, I thought the INaming container remembered the properties. =
What happens is=20
If Not Page.IsPostBack Then
CompControl1.Location =3D "C:\Inetpub\wwwroot\AVTest\XMLFile2.xml"
End If
in the parent page. Then in one of the buttons on the page I
CompControl1.Location =3D "C:\Inetpub\wwwroot\AVTest\XMLFile1.xml"
It doesn't do anything on the first click but changes the XML value on =
the second click, i.e. I can see the different controls created in the =
createchildcontrols() event based on values in the XML file. I have =
another button which sets the valu back which when I click it back twice =
on the second time creates an invalid cast error, like it is being given =
a null value instead of a string. I have even tried setting the value of =
a session or viewstate in the buttons and reading them in the page load =
event.
If Not Page.IsPostBack Then
CompControl1.Location =3D "C:\Inetpub\wwwroot\AVTest\XMLFile2.xml"
End If
If Not IsNothing(Ssesion("XMLPath")) Then
CompControl1.Location =3D Session("XMLPath")
End If
Any ideas. Regards, Chris
[quoted text, click to view] "Scott Mitchell [MVP]" <mitchell@4guysfromrolla.com> wrote in message =
news:GZaoc.7291$gm5.2802@newssvr27.news.prodigy.com...
> Chris Kennedy wrote:
> > I have a custom control which uses an XML file in the=20
> > CreateChildControls event, the XML file is used to determine how =
many=20
> > and what composite form elements to add. I can set the path to a=20
> > different XML file on Page_Load event of the parent page. When I =
press a=20
> > button even if contains no code it triggers a postback (which is=20
> > normal). Even though I am resetting the location value in Page_load=20
> > event I get a "The path is not of a legal form" error.
> > //=20
> > It is like on the postback the XML value is not being passed to the=20
> > control again.
>=20
> Are you setting the path initially in Page_Load like so:
>=20
> If Not Page.IsPostBack then
> myControl.XmlPath =3D ...
> End If
>=20
> ???
>=20
> If so, are you sure that you're control is saving this value in tbe =
view=20
> state? That is, does the property for XmlPath in your control look =
like:
>=20
> Public Property XmlPath as String
> Get
> Dim o as Object =3D ViewState("XmlPath")
> If o is Nothing then
> Return String.Empty
> Else
> Return o.ToString()
> End If
> End Get
> Set
> ViewState("XmlPath") =3D Value
> End Set
> End Property
>=20
> ???
>=20
>=20
>=20
> --=20
>=20
> Scott Mitchell
> mitchell@4guysfromrolla.com
>
http://www.4GuysFromRolla.com >
http://www.ASPFAQs.com >
http://www.ASPMessageboard.com >=20