Client Side div events

I'm using a DataList control and have the element ItemTemplate setup like this:

<ItemTemplate>
<asp:LinkButton id="SelectButton" Text="Select" CommandName="Select" runat="server" style="display:none"/>
<div style="width:300px;">
<div style="
width:150px;"><%# Container.DataItem("CourseName")%></div>
<div style="
width:150px;"><%# Container.DataItem("Location")%></div>
</div>
</ItemTemplate>

On the DataList's ItemDataBound event I'm performing the following:

    Private Sub dtlCourse_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles dtlCourse.ItemDataBound
        If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
            e.Item.Attributes.Add("onmouseover", "this.oldClass = this.className;" & "this.className = 'EntryLineOver'")
            e.Item.Attributes.Add("onmouseout", "this.className = this.oldClass;" & "this.className = 'EntryLineOff'")
            e.Item.Attributes.Add("onclick", "this.Page.ClientScript.GetPostBackEventReference(e.Item.Controls[1], string.Empty));")
        End If
    End Sub

These events aren't being added to the div tags in the html code.  If I take the mouseover and mouseout events and put it in the HTML code directly it works.  What am I doing wrong here?

 
0
xtremeIX
5/7/2008 5:24:43 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

3 Replies
1073 Views

Similar Articles

[PageSpeed] 8

Basically, I just need to know how to call a server-side function from a client-side div tag.

0
xtremeIX
5/7/2008 10:05:55 PM

Hi xtremeIX,

See this post of calling server-side function from client-side: http://forums.asp.net/t/1077470.aspx

Hope it will help me.

Thanks,


Qin Dian Tang
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
0
Qin
5/9/2008 9:13:38 AM

I think this will help to you (i use gridview)

((ImageButton)e.Row.FindControl("imgTicketDetail")).Attributes.Add("onmouseover", "ShowTooltip('" +

DataBinder.Eval(e.Row.DataItem, "TicketId").ToString() + "','" +

Convert.ToDateTime(DataBinder.Eval(e.Row.DataItem, "TicketCreatedOnDate")).ToString("dd-MM-yyyy hh:mm tt") + "','" +

DataBinder.Eval(e.Row.DataItem, "TicketSubject").ToString() + "','" +

DataBinder.Eval(e.Row.DataItem, "SupportName").ToString() + "', '" +

"<span style=\"color:" + DataBinder.Eval(e.Row.DataItem, "TicketStatusColor ").ToString() + "\">" + DataBinder.Eval(e.Row.DataItem, "TicketStatusName").ToString() + "</span>" + "','" +

"<span style=\"color:" + DataBinder.Eval(e.Row.DataItem, "TicketPriorityColor").ToString() + "\">" + DataBinder.Eval(e.Row.DataItem, "TicketPriorityName").ToString() + "</span>" + "','" +

DataBinder.Eval(e.Row.DataItem, "LastReplierName").ToString() + "','" +

DataBinder.Eval(e.Row.DataItem, "TicketLastReply").ToString().Replace("\r\n","<br/>") +

"');");

((ImageButton)e.Row.FindControl("imgTicketDetail")).Attributes.Add("onmouseout", "HideTooltip();");

 

I think for datagrid it will

e.Item.Attributes.Add("onmouseover", "Your function name of javascript");

 


If my answer useful to you,plz Marked as ANSWERED

0
sunilbotadara
5/9/2008 11:31:17 AM
Reply:

Similar Artilces:

Validation Controls in .NET ( Client side or server side?)
 i have a very basic question. We have all these validation controls in asp.net ( required field, range validator and others)..my question is the required field validator is a server side control. So does that mean that it does a post back?..is it client side or server side control  The only controls that post back are buttons and other inputs where you set AutoPostback="True", such as a dropdownlist or a textbox.  Another way of posting back is using an UpdatePanel and placing a trigger in it for a specified control and/or event. All controls are considered clien...

Server Side control invoking a Client Side event
I need to figure out how to get a server side control to process the "OnMouseOver" event. Since server side controls do not have the onmouseover event associated with them, how would you make for example, a DropDownList have a "OnMouseOver" event associate with it? The DropDownList must be server side. I guess the idea here is to set client-side events on the server-side control. Any help will be appreciated. You may try something like this: In server side code DDL1.Attributes.Add("onmouseover", "javascript:alert('Hi')") Th...

Calling a client side control event from a server side function
I would like to know how to raise an event on a client side only control from a server side function.   For example, I have Button1 whose onclick is handled at the server. The logic behind the function will do 1 of 2 things, change the text of a label to indicate a problem or navigate to a new page.  I cannot use redirect because i need the new page to appear inside 2 of 3 existing frames.  I can manage this using an anchor on the client.  All I need to do is automatically click the anchor after I post back from the Button1.click event.I tried the following line of c...

Firing both Client side event and server side event for server side button
I am having some difficulties getting this to work.. I have button_click (Asp.net) and ClientClick (Javascript).  Javascript is firing fine.  Server script is not. may be you have return return false in the in the javascript which is why its not firing server side event.You should add javascript evelt like thisbutton1.onclientclick = "functionname" Function should nopt return false. Vikram www.vikramlakhotia.comPlease mark the answer if it helped you...

How to access Client Side control in server side button click event?
Hi all, I need to access client side control from server side code. For an example <form id="form1" runat="server"> <table> <tr> <td>UserName:</td> <td><input type="text" id="textBoxUserName" /></td> <td><asp:Button ID="buttonShow" runat="server" Text="show" OnClick="buttonShow_Click" /></td> </tr> </table>   </form> I need to access the textBoxUsername in the server side button click event. How to do that? Than...

Client Side validation of Calendar control prior to server side selectionchanged event code
Hello, Any thoughts or suggestions regarding this will be greatly appreciated. I have a Calendar control with the validation constraint(can't enter appointments on Holidays or on Thursdays). To create a smoother experience, I'd like for this to be done client side. The dillema is how can I intercept or precede the <asp:calendar> controls selectionchanged event from firing and run my client javascript; passing it to the server if validation succeeds for more intensive processing and database activity. The clientside javascript will need the selected date to deter...

can picturebutton or button control use Client-Side Events and Default Event Handlers
hello all: can picturebutton or button control use Client-Side Events and Default Event Handlers? we can use Web DataWindow client-side events . How about picturebutton or button control else? for example #if defined PBWEBFORM then pb_2.JavaScriptFile = "CRM.js" pb_2.OnClicked = "PBPictureManager_delete" #else /*action*/ #end if pb_1 is picturebutton ,but complier is error. So ,How we can ? Pls thanks I don't think you can add client-side events to those controls. You can code these events if you create a button or picture button on a ...

Combining a server-side control with a client-side control!
Hi all, I am trying to combine a server-side control with a client-side control. I have created a listbox in both sides, the client-side control's code is: <select size="4" name="lstFruit" id="Select1" ondblclick="lst_dblClick" visible="false"> <option value="Banana">Banana</option> <option value="Apple">Apple</option> <option value="Mango">Mango</option> <option value="Orange">Orange</option> </select> The other one is the server-side control which has this code:   I wanted to add the ondblClick attribute to the se...

What are diff Server-side control and Client-side control ?
What are diff Server-side control and Client-side control ? and diff server -side coding and client -side coding ? please help I have answered the first part of your question in your previous posting. Server-side coding languages are ASP, ASP.NET, PHP, CGI (Perl) and many, many more. They are used to create dynamic web content (based on additional information that is attached to the request) and are often used to extract information from databases. Client-side coding languages are JavaScript, VBScript, EMACScript and are used to create dynamic content that responds to the u...

List of client side function of extenders and controls for client side
Hello All,I am using AJAX control toolkit for my current project. Now I need to find out what client side functions I can call on an extender. Lets say I am using a PopControlExtender. Now I want to show the popup from a JS funtions.If I can do a guess then it would be something like this$find('ppce').show();From where I can find what client side functions I can call on those extensders. This is really a frusterating thing. I learn about extenders only from Learn tutorials, no help here and there. Can anybody please tell me where are documentations about all the extenders in the tool...

Help with client side events Vs. server side events
Hi, Can someone look as the following script and tell me why marking the check box doesn't generate a client side event eventhough there's: onclick="checkClick()"? marked.  Thanks in advance, Sivan <%@ Page Language="c#" %><HTML> <HEAD>  <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> </HEAD> <body>  <SCRIPT language="c#" runat="Server">  void Page_Load(object s, EventArgs e) {  if (!Page.IsPostBack)  {   Label1.Text = Label...

UpdateProgress Control and client side events
All, I didn't really know how to search for this, so I figured I would lay it out here and maybe someone here would know who to accomplish what Im looking to do. I have a page with an updateprogress control on it which fires, and my server starts to process the request as normal. However I want to fire a client side event once the updateprogress panel closes to clear some settings on the client side. Is there any DOM/Browser/Javascript hook I can access?  Thanks,   John This example explains about on demand UI loading. I think this is what you are looking for http://m...

Is there a correspondance for each server side control to be equivalent to a client side html control
Where can find the list and can use that equivalence and what is its usage plsThanksThanks a lot, I appreciate your taking the time to help me. What exactly do you mean? A correspondence of what?All controls have a ClientID property, which for most controls tells the DOM element ID that will be used in the HTML rendering. Aside from that certain controls might offer additional client-side functionality, but there's no one standard.Thanks,EilonBlog: http://weblogs.asp.net/LeftSlipper/ I mean. When I am using html control in my aspx page like:  <input type=text ..>  and...

Handling validation controls events in client side
  Hi,Do u guys know if we can trap in client side when a validation is taking place or when it s finished in client side. I am talking about validation controls like: requiredfieldvalidator, RegularexpressionValidator..etc More precisely, I need to trap the event when the RegularExpressionValidator succeeds or when it fails, but I want to handle that client side. Is that possible? How please?Thank you Thanks a lot, I appreciate your taking the time to help me. Hi, client-side validation library has a few methods for example ValidatorValidate (you can view them with reflector from Sys...

Web resources about - Client Side div events - asp.net.presentation-controls

MUD client - Wikipedia, the free encyclopedia
A MUD client is a computer application used to connect to a MUD , a type of multiplayer online game . Generally, a MUD client is a very basic ...

3Q Digital Offers Peek At 3Q Facebook Ad Performance By Its Largest Clients
With Facebook set to report its third-quarter earnings Wednesday , digital marketing agency 3Q Digital offered some insight on how the social ...

Gallop Labs hires former Facebook Client Partner as Director of Sales
Gallop Labs , a social marketing and analytics firm, announced that it has hired former Facebook Client Partner Andrew Peebles as the company’s ...

All Twitter Clients Will Change From Stars/Favorites to Hearts/Likes
Twitter’s developer blog: If you’re showing Tweets without using our Embedded Tweet rendering, you’ll need to update the icons and strings in ...

Sydney builder Bill Issa convicted of attacking clients who complained about his work
... to fix up rundown family homes and transform them into something flashy and new. "It will feel like a new home," he promised one client. "It ...

Popular Instagram client removed from App Store for harvesting usernames, passwords
Apple today has pulled a popular Instagram client from the App Store after it was found to be harvesting usernames and passwords. First noticed ...

9 Ways To Lose Clients
Columnist Gary J. Ross explains how NOT to treat the client.

How to End Client-Agency Relationships on Good Terms - Agency News: Viewpoint - Advertising Age
When a client makes the decision to part ways with an agency, many challenges arise. Meetings become awkward. Momentum wanes as the client looks ...

Instagram client InstaAgent exposed as malware, pulled from App Store
A much-downloaded third-party Instagram client has just been pulled from the App Store after it was found to have behaved maliciously. The app ...

Apple pulls popular Instagram client 'InstaAgent' from iOS App Store after malware discovery
A popular Instagram profile analyzer was on Tuesday pulled from the iOS App Store after being outed as malware by a German developer who found ...

Resources last updated: 11/25/2015 2:56:19 PM