473,396 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

IsPostBack and usercontrols

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


Dec 1 '05 #1
5 1637
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(Usercontrol?) 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********@nospam.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.public.dotnet.framework.aspnet
| NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.comcast.net 24.63.42.200
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP11.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:362176
| X-Tomcat-NG: microsoft.public.dotnet.framework.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
|
|
|
|
|

Dec 2 '05 #2
Yeah I was working on that, but I just got it to work. Thanks for the help!!

--
David Lozzi
Web Applications Developer
dlozzi@(remove-this)delphi-ts.com

"Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
news:%2****************@TK2MSFTNGXA02.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(Usercontrol?) 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********@nospam.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.public.dotnet.framework.aspnet
| NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.comcast.net 24.63.42.200
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP11.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:362176
| X-Tomcat-NG: microsoft.public.dotnet.framework.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
|
|
|
|
|

Dec 2 '05 #3
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_ItemCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataListCommandEventArgs ) Handles
dlSolMenu.ItemCommand
dlSolMenu.SelectedIndex = e.Item.ItemIndex

LoadTab(e.CommandArgument)

CType(ContentControl, iTab).Initialize()
End Sub

Sub LoadTab(Optional ByVal controlName As String = "")
If controlName = "" Then
controlName = DefaultControl
dlSolMenu.SelectedIndex = 0
End If

ContentControl = Page.LoadControl(("~/admin/" & controlName))
CType(ContentControl, ITab).EID = EID
plhContent.Controls.Clear()
plhContent.Controls.Add(ContentControl)
ContentControl.ID = "ctlContent"
End Sub 'LoadTab
*****

***** details user class top 60 lines *****
Public Class details
Inherits System.Web.UI.UserControl
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 = "Initialized"
End Sub 'Init
*****

***** iTab definition *****
Namespace UserInterfaceLayer
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_ItemCommand 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****************@TK2MSFTNGXA02.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(Usercontrol?) 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********@nospam.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.public.dotnet.framework.aspnet
| NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.comcast.net 24.63.42.200
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP11.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:362176
| X-Tomcat-NG: microsoft.public.dotnet.framework.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
|
|
|
|
|

Dec 2 '05 #4
GOT IT! Yeah me! Updated my script as follows:

Sub LoadTab(Optional ByVal NewControlName As String = "")
Dim controlName As String

If NewControlName = "" Then
controlName = DefaultControl
Else
controlName = NewControlName
End If
ContentControl = Page.LoadControl(("~/admin/" & controlName))
CType(ContentControl, ITab).EID = EID
plhContent.Controls.Clear()
plhContent.Controls.Add(ContentControl)
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********@nospam.nospam> wrote in message
news:ey**************@tk2msftngp13.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_ItemCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataListCommandEventArgs ) Handles
dlSolMenu.ItemCommand
dlSolMenu.SelectedIndex = e.Item.ItemIndex

LoadTab(e.CommandArgument)

CType(ContentControl, iTab).Initialize()
End Sub

Sub LoadTab(Optional ByVal controlName As String = "")
If controlName = "" Then
controlName = DefaultControl
dlSolMenu.SelectedIndex = 0
End If

ContentControl = Page.LoadControl(("~/admin/" & controlName))
CType(ContentControl, ITab).EID = EID
plhContent.Controls.Clear()
plhContent.Controls.Add(ContentControl)
ContentControl.ID = "ctlContent"
End Sub 'LoadTab
*****

***** details user class top 60 lines *****
Public Class details
Inherits System.Web.UI.UserControl
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 = "Initialized"
End Sub 'Init
*****

***** iTab definition *****
Namespace UserInterfaceLayer
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_ItemCommand 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****************@TK2MSFTNGXA02.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(Usercontrol?) 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********@nospam.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.public.dotnet.framework.aspnet
| NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.comcast.net 24.63.42.200
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP11.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:362176
| X-Tomcat-NG: microsoft.public.dotnet.framework.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
|
|
|
|
|


Dec 2 '05 #5
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********@nospam.nospam>
| References: <uZ**************@TK2MSFTNGP11.phx.gbl>
<#O**************@TK2MSFTNGXA02.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.public.dotnet.framework.aspnet
| NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.comcast.net 24.63.42.200
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:362418
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| GOT IT! Yeah me! Updated my script as follows:
|
| Sub LoadTab(Optional ByVal NewControlName As String = "")
| Dim controlName As String
|
| If NewControlName = "" Then
| controlName = DefaultControl
| Else
| controlName = NewControlName
| End If
| ContentControl = Page.LoadControl(("~/admin/" & controlName))
| CType(ContentControl, ITab).EID = EID
| plhContent.Controls.Clear()
| plhContent.Controls.Add(ContentControl)
| 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********@nospam.nospam> wrote in message
| news:ey**************@tk2msftngp13.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_ItemCommand(ByVal source As Object, ByVal e As
| > System.Web.UI.WebControls.DataListCommandEventArgs ) Handles
| > dlSolMenu.ItemCommand
| > dlSolMenu.SelectedIndex = e.Item.ItemIndex
| >
| > LoadTab(e.CommandArgument)
| >
| > CType(ContentControl, iTab).Initialize()
| > End Sub
| >
| > Sub LoadTab(Optional ByVal controlName As String = "")
| > If controlName = "" Then
| > controlName = DefaultControl
| > dlSolMenu.SelectedIndex = 0
| > End If
| >
| > ContentControl = Page.LoadControl(("~/admin/" & controlName))
| > CType(ContentControl, ITab).EID = EID
| > plhContent.Controls.Clear()
| > plhContent.Controls.Add(ContentControl)
| > ContentControl.ID = "ctlContent"
| > End Sub 'LoadTab
| > *****
| >
| > ***** details user class top 60 lines *****
| > Public Class details
| > Inherits System.Web.UI.UserControl
| > 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 = "Initialized"
| > End Sub 'Init
| > *****
| >
| > ***** iTab definition *****
| > Namespace UserInterfaceLayer
| > 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_ItemCommand 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****************@TK2MSFTNGXA02.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(Usercontrol?) 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********@nospam.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.public.dotnet.framework.aspnet
| >> | NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.comcast.net 24.63.42.200
| >> | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP11.phx.gbl
| >> | Xref: TK2MSFTNGXA02.phx.gbl
| >> microsoft.public.dotnet.framework.aspnet:362176
| >> | X-Tomcat-NG: microsoft.public.dotnet.framework.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
| >> |
| >> |
| >> |
| >> |
| >> |
| >>
| >
| >
|
|
|

Dec 5 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Kate | last post by:
Hi: I have a picturebox control, and at runtime various usercontrols are added to it to make a diagram. As dynamically added usercontrols, they are of type VBExtender. Is there a way to save...
2
by: Emma | last post by:
Hi, I'm developing a GUI with almost all Usercontrols. It's been working wonderfull up till a few weeks ago, and really crashed yesterday. Suddenly I can no longer add some of my usercontrols...
4
by: Anders K. Jacobsen [DK] | last post by:
Hi I have some common UserControls i want to share between to sites (on the same mashine but on diffrent virtual paths). right now i have on solution file with aprox 10 projects. 2 of these is...
2
by: N. Demos | last post by:
I have a user control with code behind of which two instances are created/declared in my aspx page. The aspx page has code behind also, as I need to access methods of the usercontrols on page...
3
by: YYZ | last post by:
I swear I've done my research, and now I was just hoping someone could explain this to me. I've got a base class (usercontrol) that I am using just as an interface. Meaning, I've defined...
3
by: b747_440 | last post by:
Dear Newsgroup, I'm an old VB6.0 developper who switched some time ago to VB.NET 2005. I really like that new Visual Studio. However, something is going wrong now and I can't figure out, what it...
0
by: seigo | last post by:
Hello, I faced with the following problem. I have a PlaceHolder on a page and a few UserControls which have custom events, for instance: public delegate void SelectHandler(object sender,...
3
by: Nathan Sokalski | last post by:
I have my UserControls in a subdirectory called usercontrols. In the code for one of my UserControls I have the following: Public Property adimage() As String Get Return...
4
by: Nathan Sokalski | last post by:
In several of my UserControls I add properties. If I access these properties in the CodeBehind of the pages that use the controls, I recieve an error when compiling. The reason for this is because...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.