473,748 Members | 4,030 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1665
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
|
|
|
|
|

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******** ********@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
|
|
|
|
|

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_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
|
|
|
|
|

Dec 2 '05 #4
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
|
|
|
|
|


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********@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
| >> |
| >> |
| >> |
| >> |
| >> |
| >>
| >
| >
|
|
|

Dec 5 '05 #6

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

Similar topics

1
2275
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 the diagram as a .wmf file? (The diagram might extend beyond the confines of the actual picturebox on the screen.) I have seen examples of how to print all the controls in a picturebox
2
1436
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 to any of the others (I've also tried to create new usercontrols and windowforms and add them to the new control, but that doesn't work any better). It's really frustrating since I've been able to add them and run the program before.
4
1649
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 webprojetcs wich need to shere some common userControls. Optimally i want a class libarary project wich contains the controls so i could import the DLL and use the controls. But that of course doesnt work.
2
1978
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 submit. I've read several post here and articles on the web on this topic. What little I have learned from them is that you have to pre-compile the usercontrol in order to access it in the aspx code behind. I did this, compiling the usercontrol...
3
1527
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 several MustOverride subs in there, and also a public property. I'm going to inherit a bunch of usercontrols from this one superclass (terminology correct?) and then they all have to make sure they can respond to that set of functions that I've...
3
2101
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 is... I was playing around with UserControls which are inherited from standard .NET controls to make myself some transparent controls. Suddenly I realized that after bulding my project those UserControls do not appear in the Toolbox anymore. I had...
0
1551
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, SelectEventArgs e); public event SelectHandler OnSelect; protected void Page_Load(object sender, EventArgs e)
3
1400
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 lnkAdvertisement.ImageUrl End Get Set(ByVal value As String) Response.Write(Me.Page.ResolveClientUrl(value) & "<br/>" & ControlChars.NewLine)
4
1255
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 the compiler tries to compile the pages that use the UserControls before compiling the UserControls, and therefore does not know that the property exists when compiling. The only way around this that I have found is to use the CType() function as...
0
8991
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9548
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9249
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6076
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4607
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4876
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3315
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.