DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Fri, 03 Aug 2007 13:40:38 +0100,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    Mick Walker
          2    Eliyahu Goldin


Repeater Question   
Hi All,

I am using a repeater to display messages to users within my website. I 
get the messages by binding a SqlDataSource to the repeater, and 
accessing them directly from the database.
However, in my messages database, I only store the GUID of the user whom 
sent the message.

Currently I bind the data to the repeater as so:
<ItemTemplate>
                         <tr>
                             <td align="left" valign="top"><asp:label 
ID="lblDate" Text='<%#Eval("DateSent") %>' runat="server"></asp:label></td>
                             <td align="left" valign="top"><asp:Label 
ID="lblfrom" Text='<%#Eval("FromID") %>' runat="server"></asp:Label></td>
                             <td align="left" valign="top"><asp:label 
ID="lblSubject" Text='<%#Eval("Subject") %>' 
runat="server"></asp:label><asp:TextBox ID="txtMsgID" runat="server" 
Visible="false" Text='<%#Eval("ID") %>' /></td>
                             <td align="left" valign="top">
                                 <asp:CheckBox ID="chkAction" 
runat="server" />
                             </td>
                         </tr>
                     </ItemTemplate>

This obviously only gives me the user ID of the person whom sent the 
message.

Is there any way, within my codebehind I could create a function such as:

Public Function GetUserName(byval UserID as Guid) as string
	look up the users username in the access table, by their GUID
	
	Return the Username
End Function

And then call this function from my markup(within the repeater 
itemtemplate)then bind the return value to the repeater?

Kind Regards
Mick Walker
Date:Fri, 03 Aug 2007 13:40:38 +0100   Author:  

Re: Repeater Question   
This should do:

<asp:Label > ID="lblfrom" Text='<%# GetUserName(Eval("FromID")) %>'
runat="server"></asp:Label>

-- 
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin


"Mick Walker"  wrote in message
news:5hgm26F3k4tg1U1@mid.individual.net...

> Hi All,
>
> I am using a repeater to display messages to users within my website. I
> get the messages by binding a SqlDataSource to the repeater, and
> accessing them directly from the database.
> However, in my messages database, I only store the GUID of the user whom
> sent the message.
>
> Currently I bind the data to the repeater as so:
> <ItemTemplate>
>                          <tr>
>                              <td align="left" valign="top"><asp:label
> ID="lblDate" Text='<%#Eval("DateSent") %>'

runat="server"></asp:label></td>

>                              <td align="left" valign="top"><asp:Label
> ID="lblfrom" Text='<%#Eval("FromID") %>' runat="server"></asp:Label></td>
>                              <td align="left" valign="top"><asp:label
> ID="lblSubject" Text='<%#Eval("Subject") %>'
> runat="server"></asp:label><asp:TextBox ID="txtMsgID" runat="server"
> Visible="false" Text='<%#Eval("ID") %>' /></td>
>                              <td align="left" valign="top">
>                                  <asp:CheckBox ID="chkAction"
> runat="server" />
>                              </td>
>                          </tr>
>                      </ItemTemplate>
>
> This obviously only gives me the user ID of the person whom sent the
> message.
>
> Is there any way, within my codebehind I could create a function such as:
>
> Public Function GetUserName(byval UserID as Guid) as string
> look up the users username in the access table, by their GUID
>
> Return the Username
> End Function
>
> And then call this function from my markup(within the repeater
> itemtemplate)then bind the return value to the repeater?
>
> Kind Regards
> Mick Walker
Date:Fri, 3 Aug 2007 16:01:01 +0200   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us