Click here to Skip to main content
16,005,290 members
Home / Discussions / Web Development
   

Web Development

 
GeneralRe: dumbass question #1... Pin
Philip Patrick26-Apr-02 0:46
professionalPhilip Patrick26-Apr-02 0:46 
GeneralRe: dumbass question #1... Pin
Nick Parker25-Apr-02 13:11
protectorNick Parker25-Apr-02 13:11 
GeneralChanging cursor in JavaScript Pin
jerry0davis25-Apr-02 2:02
jerry0davis25-Apr-02 2:02 
GeneralRe: Changing cursor in JavaScript Pin
jerry0davis25-Apr-02 3:18
jerry0davis25-Apr-02 3:18 
GeneralRe: Changing cursor in JavaScript Pin
Andy Smith25-Apr-02 6:36
Andy Smith25-Apr-02 6:36 
GeneralLooking for DB sample... Pin
Todd Smith24-Apr-02 7:21
Todd Smith24-Apr-02 7:21 
GeneralRe: Looking for DB sample... Pin
Nick Parker25-Apr-02 6:04
protectorNick Parker25-Apr-02 6:04 
GeneralProblem with usercontrol in datalist Pin
23-Apr-02 21:24
suss23-Apr-02 21:24 
I'm having difficulties with my user control used in a datalist.

I have a datalist with an 'itemtemplate' and an 'edittemplate' defined like this:

<ItemTemplate>
<b>Title:</b><%# DataBinder.Eval(Container.DataItem, "TITLE")%>
<asp:LinkButton CommandName="Edit" Runat="server" Text="Edit news"></asp:LinkButton>
</ItemTemplate>
<EditItemTemplate>
<b>Title:</b><%# DataBinder.Eval(Container.DataItem, "TITLE")%>
</EditItemTemplate>

The datalist is bound to a data source. When I render the page, the 'Title' is displayed correctly. When I click the edit link, the 'Title' is still displayed correctly.

Now, I have made a user control called TitleBar, which accepts a title, backcolor and so on, and then uses that information to display a nicely centered title on the page. I use it like this:

<CP:TitleBar id="MainTitle" title="News for today!" BackColor="darkgreen" runat="server" Padding="2" HorizontalAlignment="center" TextColor="white" FontSize="13"></CP:TitleBar>

In a normal page, my user control works fine.

Now, here's the problem. If I use my user control in the datalist, like this:

<ItemTemplate>
<CP:TitleBar id="MainTitle" title='<%# DataBinder.Eval(Container.DataItem, "TITLE")%>' BackColor="darkgreen" runat="server" Padding="2" HorizontalAlignment="center" TextColor="white" FontSize="13"></CP:TitleBar>
<asp:LinkButton CommandName="Edit" Runat="server" Text="Edit news"></asp:LinkButton>
</ItemTemplate>
<EditItemTemplate>
<CP:TitleBar id="MainTitle" title='<%# DataBinder.Eval(Container.DataItem, "TITLE")%>' BackColor="darkgreen" runat="server" Padding="2" HorizontalAlignment="center" TextColor="white" FontSize="13"></CP:TitleBar>
</EditItemTemplate>

... then the page is rendered fine too, but when I click the edit link, nothing is rendered. In fact, it seems that 'Title' is empty.

However if I directly use a string to pass to my user control (instead of the databinder), it does work fine, even if I click the edit button:

<ItemTemplate>
<CP:TitleBar id="MainTitle" title='TEST' BackColor="darkgreen" runat="server" Padding="2" HorizontalAlignment="center" TextColor="white" FontSize="13"></CP:TitleBar>
<asp:LinkButton CommandName="Edit" Runat="server" Text="Edit news"></asp:LinkButton>
</ItemTemplate>
<EditItemTemplate>
<CP:TitleBar id="MainTitle" title='TEST' BackColor="darkgreen" runat="server" Padding="2" HorizontalAlignment="center" TextColor="white" FontSize="13"></CP:TitleBar>
</EditItemTemplate>

I hope I explained the situation clearly. Any ideas why the combination of my user control, a datalist, passing a parameter with DataBinder.Eval and clicking the edit link does not work?


Ludwig
QuestionASP Site Authentication...? Pin
alex.barylski23-Apr-02 20:47
alex.barylski23-Apr-02 20:47 
AnswerRe: ASP Site Authentication...? Pin
David Wengier23-Apr-02 21:03
David Wengier23-Apr-02 21:03 
GeneralRe: ASP Site Authentication...? Pin
l a u r e n23-Apr-02 22:20
l a u r e n23-Apr-02 22:20 
GeneralRe: ASP Site Authentication...? Pin
alex.barylski24-Apr-02 8:26
alex.barylski24-Apr-02 8:26 
GeneralRe: ASP Site Authentication...? Pin
alex.barylski24-Apr-02 8:20
alex.barylski24-Apr-02 8:20 
GeneralRe: ASP Site Authentication...? Pin
Philip Patrick24-Apr-02 9:24
professionalPhilip Patrick24-Apr-02 9:24 
GeneralRe: ASP Site Authentication...? Pin
alex.barylski25-Apr-02 14:09
alex.barylski25-Apr-02 14:09 
GeneralRe: ASP Site Authentication...? Pin
David Wengier24-Apr-02 12:19
David Wengier24-Apr-02 12:19 
GeneralAIM & Error Loading Content; dealing with spaces in screen names Pin
mrhsean23-Apr-02 12:36
mrhsean23-Apr-02 12:36 
GeneralRe: AIM & Error Loading Content; dealing with spaces in screen names Pin
Domenic Denicola24-Apr-02 3:46
Domenic Denicola24-Apr-02 3:46 
GeneralRe: AIM & Error Loading Content; dealing with spaces in screen names Pin
mrhsean24-Apr-02 8:42
mrhsean24-Apr-02 8:42 
GeneralRe: AIM & Error Loading Content; dealing with spaces in screen names Pin
Domenic Denicola24-Apr-02 16:43
Domenic Denicola24-Apr-02 16:43 
GeneralRe: AIM & Error Loading Content; dealing with spaces in screen names Pin
mrhsean25-Apr-02 5:51
mrhsean25-Apr-02 5:51 
GeneralRe: AIM & Error Loading Content; dealing with spaces in screen names Pin
nickt6-May-02 14:07
nickt6-May-02 14:07 
General"New!" icon the forums Pin
Toni Navarro23-Apr-02 1:09
Toni Navarro23-Apr-02 1:09 
GeneralRe: "New!" icon the forums Pin
James T. Johnson23-Apr-02 2:33
James T. Johnson23-Apr-02 2:33 
GeneralRe: "New!" icon the forums Pin
Toni Navarro23-Apr-02 4:50
Toni Navarro23-Apr-02 4:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.