473,802 Members | 2,031 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Updating a Label in a DataList from an associated control in the same Datalist?

4 New Member
OK...I have a datalist that, in each row, has control and a label. What I want to happen is for the text in the label to update when its associated control is clicked.

Here's what I have so far...just need to get that label updating.

The Control's OnChange Event:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Rating_Changed(ByVal sender As Object, ByVal e As AjaxControlToolkit.RatingEventArgs)
  2.         Dim SQL As String
  3.         Dim ExecSP As New dbFun
  4.  
  5.         SQL = "exec RateSong " & _
  6.                 "@UserID=" & Request.Cookies("MLKLogin")("UserID") & ", " & _
  7.                 "@AudioID=" & e.Tag.ToString & ", " & _
  8.                 "@Rating=" & e.Value.ToString
  9.         ExecSP.ExecuteSP(SQL)
  10.  
  11.         '----UPDATE AVG RATING LABEL CODE HERE----
  12.  
  13. End Sub
And the Datalist:

Expand|Select|Wrap|Line Numbers
  1. <asp:DataList id="theDataList" runat="server" RepeatLayout="Flow"> 
  2.             <ItemTemplate> 
  3.                     <div class="Rating">
  4.  
  5.                         <ajaxToolkit:rating ID="SongRating" runat="server"
  6.                             CurrentRating='<%# Eval("USERRATING") %>'
  7.                             MaxRating="5"
  8.                             StarCssClass="ratingStar"
  9.                             WaitingStarCssClass="filledRatingStar"
  10.                             FilledStarCssClass="filledRatingStar"
  11.                             EmptyStarCssClass="emptyRatingStar"
  12.                             OnChanged="Rating_Changed"
  13.                             Tag='<%# Eval("AUDIO_ID") %>'
  14.                             AutoPostBack="false"
  15.                         />
  16.  
  17.  
  18.                         <asp:Label ID="AvgLabel" runat="server" Text="avg: " CssClass="SmallText" AssociatedControlID="SongRating"><%# Eval("AVGRATING")%></asp:Label>
  19.  
  20.  
  21.                      </div>
  22.                 </div>                 
  23.             </ItemTemplate>        
  24. </asp:DataList>
Any help would be GREATLY appreciated!
Apr 2 '08 #1
0 1070

Sign in to post your reply or Sign up for a free account.

Similar topics

3
1609
by: Colin Young | last post by:
I'm having a bit of a problem with my DataList when I try to update from the user's input. I've included relevant excerpts at the end of this message. In the UpdateCommand code, the "PageLevelTextBox" appears to be found (it isn't returning null), but the Text property is an empty string (""). Am I missing something really obvious? Thanks Colin
3
5361
by: Dude | last post by:
Below is the code - it is finding the control, and there is no error, just not assigning the text to the label <asp:DataList id="dlGoals" runat="server" onEditCommand="myListEditHandler" onUpdateCommand="myListUpdateHandler" onCancelCommand="myListCancelHandler" onDeleteCommand="myListDeleteHandler" DataKeyField="ID"> <ItemTemplate>
9
2583
by: jjack100 | last post by:
I want to set the text value of a label that is within a datalist in the codebehind. Does this have to be done in the databound event? Simplified example: <asp:DataList id="dlItem" runat="server"> <ItemTemplate> <asp:Label ID="lblItemPrice" runat="server" /> </ItemTemplate> </asp:DataList>
1
2243
by: Pavan | last post by:
Hi All, I have created a custom DataList web custom control, which populates data from a dataset. This dataset is available at runtime and exposed as property by my custom control. During preRender event of custom control, i populate Column Headers, Item Data from the DataSet using CustomTemplate class for my inner DataList
1
4292
by: Jameel | last post by:
Hi Coders, How do i Add a Lable control to DataList to show the Count Files which belong the current Category. i have a DataList which displays categoryName,Description and File counter (coutn the images belong to category), i able to display first 2 values from database, but how to dispalyg the image counted data in DataList ? Here is my code which doesnt working:(i am using code behind to pull the data from DB)
1
3896
by: | last post by:
I have a label control that I've embedded in a datalist template. I will be binding data to that label. I want to run a string formatting function on the database text before it is injected into the datalist. When I try to do this, I get a "... does not exist in the current context. I need to know how to target the control. If I were writing Flash actionscript, it would be something like
7
2534
by: rn5a | last post by:
How can I place a Label control in the FooterTemplate of a DataList control? I tried this <script runat="server"> Sub Page_Load(obj As Object, ea As EventArgs) Dim dblTotal As Double Dim sqlReader As SqlDataReader
2
3857
by: rn5a | last post by:
Consider the following code: <script runat="server"> Sub ShowData(obj As Object, ea As EventArgs) lblDate.Text = DateTime.Now.ToString("d") lblDate.DataBind() End Sub </script> <form runat="server"> <asp:Label ID="lblDate" OnDataBinding="ShowData" runat="server"/>
1
2660
by: Jim in Arizona | last post by:
On one page I have a datalist where a message is bound to a label. On another page I have the datalist which allows for the insert of new message as well as being able to edit those messages. The editing (EditItemTemplate) has a textbox that loads the message into its text property. The problem I'm running into is working with vbCrLf and <brinterchangeably between the textbox on the admin page and the label on the general message page. I...
0
9562
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10536
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10304
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9114
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7598
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6838
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5494
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4270
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3792
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.