Cool! Glad that you've got it working.
Have a nice day!
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "David Lozzi" <Da********@nos pam.nospam>
| References: <uZ************ **@TK2MSFTNGP11 .phx.gbl>
<#O************ **@TK2MSFTNGXA0 2.phx.gbl>
<ey************ **@tk2msftngp13 .phx.gbl>
| Subject: Re: IsPostBack and usercontrols
| Date: Fri, 2 Dec 2005 15:58:08 -0500
| Lines: 231
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| X-RFC2646: Format=Flowed; Response
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| Message-ID: <#r************ **@TK2MSFTNGP12 .phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.com cast.net 24.63.42.200
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP12.phx. gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3624 18
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| GOT IT! Yeah me! Updated my script as follows:
|
| Sub LoadTab(Optiona l ByVal NewControlName As String = "")
| Dim controlName As String
|
| If NewControlName = "" Then
| controlName = DefaultControl
| Else
| controlName = NewControlName
| End If
| ContentControl = Page.LoadContro l(("~/admin/" & controlName))
| CType(ContentCo ntrol, ITab).EID = EID
| plhContent.Cont rols.Clear()
| plhContent.Cont rols.Add(Conten tControl)
| ContentControl. ID = "ctlContent "
| End Sub 'LoadTab
|
| And put the LoadTab() in Page_load. and it works great. I can also update
| info on the controls. Thanks for your help!!
|
| --
| David Lozzi
| Web Applications Developer
|
dlozzi@(remove-this)delphi-ts.com
|
|
|
| "David Lozzi" <Da********@nos pam.nospam> wrote in message
| news:ey******** ******@tk2msftn gp13.phx.gbl...
| > OK, I lied. It was working but not correctly The LoadData was being run
on
| > everytime the page loaded. I got a little excited. I am still having
the
| > same issue. Here is my partial scripts:
| >
| > ***** tabs page *****
| > Public DefaultControl As String
| > Public Tabs As ArrayList
| > Private ContentControl As Control
| > Public ActiveClass As String
| > Public InactiveClass As String
| > Private EID As Integer
| >
| > Private Sub dlSolMenu_ItemC ommand(ByVal source As Object, ByVal e As
| > System.Web.UI.W ebControls.Data ListCommandEven tArgs) Handles
| > dlSolMenu.ItemC ommand
| > dlSolMenu.Selec tedIndex = e.Item.ItemInde x
| >
| > LoadTab(e.Comma ndArgument)
| >
| > CType(ContentCo ntrol, iTab).Initializ e()
| > End Sub
| >
| > Sub LoadTab(Optiona l ByVal controlName As String = "")
| > If controlName = "" Then
| > controlName = DefaultControl
| > dlSolMenu.Selec tedIndex = 0
| > End If
| >
| > ContentControl = Page.LoadContro l(("~/admin/" & controlName))
| > CType(ContentCo ntrol, ITab).EID = EID
| > plhContent.Cont rols.Clear()
| > plhContent.Cont rols.Add(Conten tControl)
| > ContentControl. ID = "ctlContent "
| > End Sub 'LoadTab
| > *****
| >
| > ***** details user class top 60 lines *****
| > Public Class details
| > Inherits System.Web.UI.U serControl
| > Implements ITab
| >
| > #Region " Web Form Designer Generated Code "
| >
| > Public _eid As Integer
| >
| > Public Property EID() As Integer Implements ITab.EID
| > Get
| > Return _eid
| > End Get
| > Set(ByVal Value As Integer)
| > _eid = Value
| > End Set
| > End Property
| >
| > Public Sub Initialize() Implements ITab.Initialize
| > LoadData()
| > lblError.Text = "Initialize d"
| > End Sub 'Init
| > *****
| >
| > ***** iTab definition *****
| > Namespace UserInterfaceLa yer
| > Public Interface ITab
| >
| > Property EID() As Integer
| >
| > Sub Initialize()
| >
| > End Interface 'ITab
| > End Namespace
| > *****
| >
| > If I put the initialize command right after the line where the EID is
| > assigned in LoadTab(), the data loads everytime. This is bad because I
| > cannot update the data. The dlSolMenu_ItemC ommand is suppose to call
the
| > Initialize sub, but it doesn't.
| >
| > Thanks!!
| >
| > --
| > David Lozzi
| > Web Applications Developer
| >
dlozzi@(remove-this)delphi-ts.com
| >
| >
| >
| > "Steven Cheng[MSFT]" <st*****@online .microsoft.com> wrote in message
| > news:%2******** ********@TK2MSF TNGXA02.phx.gbl ...
| >> Hi David,
| >>
| >> Welcome.
| >> From your description, you're using DataList to build a navigate
bar/menu
| >> like control on a web page and when user clicking certain items on it,
| >> the
| >> page will load a certain control(Usercon trol?) into a PlaceHolder on
the
| >> page. Since there exists Data Load code in the Control's internal code
| >> which is done only in (!IsPostBack), you found that when you swtiching
| >> between the different tabs, the Data will lost (not being loaded..)
,yes?
| >> If anything I misunderstood, please feel free to let me know...
| >>
| >> If the above is your current case, based on my experience, if your
| >> loading
| >> data code is added in the Control's Load event handler's code, it can
not
| >> be controled by outside and is automatically called after the control
is
| >> added into the parent container and the parent's load event fires. So
I
| >> think you can consider exposing a public method on your Control which
do
| >> the samething as what you do current as below:
| >>
| >> if not ispostback then
| >> LoadData()
| >> end if
| >>
| >> Thus, we can call that public method to make your control loading data
| >> each
| >> time the control has been added into the parent container (when user
| >> click
| >> a new menu item in DataList....)
| >>
| >> How do you think of this?
| >>
| >> Regards,
| >>
| >> Steven Cheng
| >> Microsoft Online Support
| >>
| >> Get Secure!
www.microsoft.com/security
| >> (This posting is provided "AS IS", with no warranties, and confers no
| >> rights.)
| >>
| >>
| >> --------------------
| >> | From: "David Lozzi" <Da********@nos pam.nospam>
| >> | Subject: IsPostBack and usercontrols
| >> | Date: Thu, 1 Dec 2005 16:47:21 -0500
| >> | Lines: 35
| >> | X-Priority: 3
| >> | X-MSMail-Priority: Normal
| >> | X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| >> | X-RFC2646: Format=Flowed; Original
| >> | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| >> | Message-ID: <uZ************ **@TK2MSFTNGP11 .phx.gbl>
| >> | Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| >> | NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.com cast.net 24.63.42.200
| >> | Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP11.phx. gbl
| >> | Xref: TK2MSFTNGXA02.p hx.gbl
| >> microsoft.publi c.dotnet.framew ork.aspnet:3621 76
| >> | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
| >> |
| >> | Hello,
| >> |
| >> | I have an interesting issue, so bear with me as I try to explain. I
| >> have
| >> a
| >> | datalist posing as tabs for my application. And as each tab is
clicked,
| >> a
| >> | placeholder is then populated with the associated control. For
Example:
| >> |
| >> | Details | Advanced | Configuration | Policies
| >> | <placeholder>
| >> |
| >> | The jumping around works great. I can see each control when clicked.
| >> Here's
| >> | my problem. Each page has fields to be updated against my database.
| >> When
| >> a
| >> | user first clicks to edit the record, the page defaults to Details
tab
| >> and
| >> | displays the corresponding data. Information can be updated
| >> successfully.
| >> | When clicking Details, or any tab for that matter, the user control
| >> loads
| >> | correctly but the data is not displayed because the call to load the
| >> data
| >> is
| >> | only when the page is not ispostback.
| >> |
| >> | if not ispostback then
| >> | LoadData()
| >> | end if
| >> |
| >> | So at first viewing, the page is not ispostback and it loads the data
| >> into
| >> | the fields. When a click on one of the tabs occurs, technically its a
| >> post
| >> | back because its all one page. Whats the best way to resolve this??
| >> |
| >> | Thanks,
| >> |
| >> | --
| >> | David Lozzi
| >> | Web Applications Developer
| >> |
dlozzi@(remove-this)delphi-ts.com
| >> |
| >> |
| >> |
| >> |
| >> |
| >>
| >
| >
|
|
|