How do I use the ItemDataBound event within my asp.net listview control?

Hi,

I have developed an asp.net web application using visual studio 2008 that has a listview frontend and an sql server 2005 database backend. I am using a linq to sql datacontext to connect to my backend db. I am hoping to hook up my ajax rating control's "CurrentRating" attribute to a backend db column value using my listview's ItemDataBound event. I have written the attached code but I can't seem to access my db column for binding?....
protected void lvTrustAccounts_ItemDataBound(object sender, ListViewItemEventArgs e)
    {
        if (e.Item.ItemType == ListViewItemType.DataItem)
        {
            AjaxControlToolkit.Rating rating = (AjaxControlToolkit.Rating)e.Item.FindControl("Rating1");
            tblTrader linqObj = (tblTrader)e.Item.???; // tblTrader is my linq table name but I can't seem to access the column trader_overall_trading which lies within this table? 
            rating.CurrentRating = linqObj.Rating;
        }
    }

Open in new window

aspnet-scotlandAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

masterpassCommented:
Instead of doing like this ... you can just specify

CurrentRating='<%# Eval("Rating") %>' //this is insdie the asp tag itself and not in codebehind

Rating the dataColumnname from the datasource

0
aspnet-scotlandAuthor Commented:
masterpass,

That worked thanks. Do you know if it's possible to change to ajax rating control so it accepts float or double data type values, i.e. 3.4 instead of round integer values?

Thanks.
0
masterpassCommented:
aspnet-scotland,

No, If you look at the documentation of the ajax rating control  you will see it accepts only integer values and no decimal or float

NB: you can download ajaxtoolkit from the codeplex and then make modification so that it accepts float. But believe me it is going to be very tedious
link for download : http://www.codeplex.com/AjaxControlToolkit
0
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

aspnet-scotlandAuthor Commented:
I have already downloaded the ajaxtoolkit so where can I access the appropriate files to modify? Where exactly is the code behind the rating control?

Thanks.
0
masterpassCommented:
every thing will be inside a folder .... There will be a folder by the name of Rating ... youcan just click the solution file provided and then you will have every thing in the solution explorer
0
aspnet-scotlandAuthor Commented:
I have my solution explorer open but I cannot see a Rating file? To install the ajaxtoolkit I had to reference a .dll file, will everything be inside this? How can I open the .dll to access the relevant code?

Thanks.
0
masterpassCommented:
Try this link (you had to select the source code from the original link ...)

http://ajaxcontroltoolkit.codeplex.com/SourceControl/list/changesets
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
aspnet-scotlandAuthor Commented:
Excellent, thank you!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.