Working with a datalist

A

Aussie Rules

Hi,

I have a data list that is bound to a datasource which is just a list of
products from a sql table.

What I want to do is configure the data list so that when i person clicks on
an item in the datalist, it redirects them to a page that displays info on
that product.

What I can't figure out is in the templates is how to setup a databinding to
the datalist title so that when the user clicks on the label, the redirect
occurs..

Is this even possible ?

Thanks
 
A

Aussie Rules

Ok, i have worked out how to achive what i wanted below, the problem now is
that the when you mouse the mouse pointer of the link, the mouse because a
straight line (like a edit mouse pointer) where as I need it to be the
normal link mouse pointer, so the user can see clearly what to do

How can I set the mouse pointer to be the normal pointer for a href url link
?

Thanks
 
G

Guest

Hello Aussie Rules,

You can add a cursor property to the style attribute to change the cursor to
whatever you would like:

<asp:Label ID="Label1" runat="server" Text="Label"
CssClass="HandCursor"></asp:Label>

In your stylesheet add something like the following element:

..HandCursor
{
cursor:hand;
}

For more information on the cursor property check out:
http://www.pageresource.com/dhtml/csstut10.htm
 
S

Steven Cheng[MSFT]

Thanks for Brians' good suggestion.

Hi Aussie,

As Brians has suggested, you can use the "cursor" css style to customize
the mouse curor of your html element.

BTW, how do you resolve your first question? Would you also provide us your
DataList item template? There are several different solutions on this
according to the html template of your datalist control. Here is a simple
DataList whicn use an html <table> to display data item in Item template.
And I use table's "onclick" script event to redirect the page, also for
html <table>, we can use the "title" attribute to display a "tooltip" when
the user hover the curor over the html table:

=============================
<asp:DataList ID="DataList1" runat="server" DataKeyField="CategoryID"
DataSourceID="SqlDataSource1">
<ItemTemplate>

<table
onclick="javascript:window.location.href='detailinfo.aspx?cid=<%#Eval("Categ
oryID") %>';"
style="cursor:pointer"
title="Click to view detailed information..."

<tr>
<td>
CategoryID:
<asp:Label ID="CategoryIDLabel"
runat="server" Text='<%# Eval("CategoryID") %>'>
</asp:Label><br />
CategoryName:
<asp:Label ID="CategoryNameLabel"
runat="server" Text='<%# Eval("CategoryName") %>'>
</asp:Label><br />
Description:
<asp:Label ID="DescriptionLabel"
runat="server" Text='<%# Eval("Description") %>'>
</asp:Label><br />
<br />
</td>
</tr>
</table>

</ItemTemplate>
</asp:DataList>
===============================

Hope this helps also.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.
 
S

Steven Cheng[MSFT]

Hi Aussie,

Have you got progress on this issue or have resolved it?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top