reloading .ascx files from within themselves

Results 1 to 2 of 2

Thread: reloading .ascx files from within themselves

  1. #1
    Join Date
    Dec 1969

    Default reloading .ascx files from within themselves

    Hi. I am currently working on an ascx file which is used to gather a lot of information (several radio buttons and text boxes, etc.) along with several variables. I have a "clear" button which will remove everything that the user has entered. At first I was just going to go through and set all the .text values to "" and uncheck all the radio buttons, clear the variables, but then I thought it would be much easier to just reload the page. The problem is I can't find any way to do this. Does anyone know? (I've found for aspx pages, but not ascx).

  2. #2

    Default RE: reloading .ascx files from within themselves

    A tweaky way... you will need to test it.<BR><BR>MustSelect1 and I add a declaration to the code behind.<BR>protected MustSelect MustSelect1;<BR><BR>in a button click:<BR><BR>ControlCollection parent = MustSelect1.Parent.Controls;<BR> Control rep = LoadControl(MustSelect1.TemplateSourceDirectory+"/"+MustSelect1.GetType().Name.Replace("_ascx",".asc x"));<BR> for(int i =0 ; i &#060; parent.Count;i++)<BR> {<BR> if(parent[i] == MustSelect1)<BR> {<BR> rep.ID=MustSelect1.ID;<BR> parent.Remove(MustSelect1); <BR> parent.AddAt(i,rep);<BR> // Response.Write("HERE");<BR> break;<BR> }<BR> }<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts