HighTechTalks DotNet Forums  

Problem with UserControl Property in a DataGrid after Postback

ASP.net Building Controls microsoft.public.dotnet.framework.aspnet.buildingcontrols


Discuss Problem with UserControl Property in a DataGrid after Postback in the ASP.net Building Controls forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Andreas Klemt
 
Posts: n/a

Default Problem with UserControl Property in a DataGrid after Postback - 07-08-2003 , 11:18 AM






Hello,
I have this

page.aspx
----------
<%@ Register TagPrefix="uc1" TagName="Userdetails" Src="Userdetails.ascx" %>
...
<asp:datagrid id="dgTest" runat="server" autogeneratecolumns="False" >
<columns>
<asp:templatecolumn>
<itemtemplate>
My UserID is: <%# Container.DataItem("userID") %><br> <<<--- THIS WORKS,
AFTER POSTBACK
<uc1:Userdetails id="ctlUserdetails" userid='<%#
Container.DataItem("userID") %> runat="server" /> <<<----- AFTER
POSTBACK userid=0
</itemtemplate>
</asp:templatecolumn>
</columns>
</asp:datagrid>


Userdetails.ascx
-----------------

Dim _userID As Integer
Public Property ClientID() As Integer
Get
Return _userID
End Get
Set(ByVal Value As Integer)
_userID = Value
End Set
End Property

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Response.Write (_userID & "<br>")
End Sub

---------------------------------------------------
The first time the page gets loaded everything works fine.

When I do a Postback, in my DataGrid the the userID's are ok with the first
DataBound
My UserID is: <%# Container.DataItem("userID") %>

but in my UserControl Property Call

<uc1:Userdetails id="ctlUserdetails" userid='<%#
Container.DataItem("userID") %>

the userid is =0. Why?

Thanks for any help!
Andreas




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.