Repeater Question

  • Thread starter Thread starter Mick Walker
  • Start date Start date
M

Mick Walker

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
 
Back
Top