Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

Hi,

 

I am playing around with an existing intranet application. This web application is a query tool that does many different types of queries depending on the selections made by the user. At present what ever type of query the user selects will cause the page to redirect to the relevant page for that query. It is ok and there are no issues. It's just looks a bit naff having the page refresh and flicker everytime the query type changes. Also get more unmaintainable as time goes on.

 

I have added a user control for the user selection and used some ajax in it and it looks much smoother. What I am now trying to do is have just one web page and dynamically add the appropriate user control/s.

 

Here is where I am up to.

 

I have an event on the page that the user selection control can raise. From this I can call a populate method in the appropriate user control that will show that particular type of search. Here is the code that does this:

userctrl.Populate(Field, Value)
Dim ctrl As New Control
ctrl = LoadControl("UserControls/userctrl.ascx")
Me.Controls.Add(ctrl)

The control does not show. I have stepped through on the debugger, it goes through all of the code with no errors, but still results in not showing.

 

The control still fails to show, can somebody please tell me what I am doing wrong?

 

Cheers, Dave.

Edited by davearia
Posted

The user control is there on the page. The problem seems to be that it is not updating. So if you click the submit button it calls a method in the user control, this correctly does everything it needs to do. But when you come back to the page level the user control is not refreshed. So when you view the page source the user control looks as it did when the page first loaded.

 

I need to reload the user control.

 

Does anyone know how to acheive this?

Posted

Firstly sorry I wasn't clear. I wasn't adding them dynamically. What I was trying to do was to update them dynamically. In other words when I said load them dynamically it's more a case of reloading than the intial load. As I said I apologize for this threads title.

 

Anyway I have fixed it. What I did was put this user control in an AJAX update panel and said this panel update mode to conditional. Then once I call to process the user control I just added userControl.Update(). Works well not a flicker in sight.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...