Client side script for ImageButton

i've an Image Button in a item template of datalist bound to data. currently i've added some code in button_click event processed server side....but i want to write a client side script for that with the data bound....the container.dataitem and container.itemindex...but thats syntactically wrong...so please correct me

 

<asp:UpdatePanel ID="MyupdPnl" runat="server">
            <ContentTemplate>
                <asp:DataList ID="DlstPosition" runat="server" BorderColor="Black" BorderWidth="0px"
                    CellPadding="0" DataSourceID="ObjectDataSource1" RepeatColumns="8" RepeatDirection="Horizontal">
                    <SelectedItemStyle BackColor="#00C000" />
                    <ItemTemplate>
                        <asp:ImageButton ID="imgBtnPiece" runat="server" CommandArgument="<%# Container.ItemIndex %>"
                            CommandName="Square" ImageUrl="<%# Container.DataItem %>" OnClientClick='mSelect(<%# Container.DataItem %>,<%# Container.ItemIndex %>)' />
                    </ItemTemplate>
                    <SeparatorStyle BackColor="Black" Font-Bold="False" Font-Italic="False" Font-Overline="False"
                        Font-Strikeout="False" Font-Underline="False" />
                </asp:DataList><asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
                    SelectMethod="getPosition" TypeName="MyService">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="lbluserID" Name="userid" PropertyName="Text" Type="String" />
                    </SelectParameters>
                </asp:ObjectDataSource>
                &nbsp;
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="DlstPosition" EventName="PreRender" />
            </Triggers>
        </asp:UpdatePanel>

0
anujpandit
9/10/2007 11:07:52 AM
asp.net.ajax-ui 9760 articles. 0 followers. Follow

1 Replies
975 Views

Similar Articles

[PageSpeed] 21
Get it on Google Play
Get it on Apple App Store

The way I usually do this is to call a function like so:  OnClientClick='<%# GetFunction(Container.DataItem,Container.ItemIndex) %>'  and then have the GetFunction method be a public or protected method in the codefile that takes an object and an integer and generates a string corresponding to your javascript function signature.  Not sure what your javascript can do w/ the Container.DataItem object, though; that's a server-side object.

0
paul
9/10/2007 1:13:51 PM
Reply:

Similar Artilces:

Using AJAX and client side scripting with .NET objects?
I'm wanting to use client-side scripting and AJAX with some drop down boxes.  I can't seem to do this with server-side .NET objects... changing the runat tag doesn't do anything either.  How can I expose .NET server objects so that they are affected by java script and AJAX? Depends on what, exactly, you're trying to do with them.  If you just need access to the html properties (e.g. selectedValue), then you simply grab them as if they were their html equivilants (select element) in javascript.  If you want to pass custom properties back and forth (or any .Net property ...

client-side scripting or server-side scripting
I want to perform data validation in my page using javascript before the data is sent to my server, but I am very confuse that I don't know which way to perform, client-side validation or server-side validation? My javascript bible told me that javascript is a client-side scripting for data validation in client pc, but when I look in my asp.net bible, the validation part is done at server side. The worst is that, I find no way to use javascript in .asp or .aspx environment. I am really confuse with all these, could any one help me on this? Thanks. Use .NET validator co...

communication between client side(java script) and server side in .net project
I have a question which is, when building a .net project, we are able to use server side code and client side code(java script). How do they communicate? Thanks Client Side coding works with the WebBrowser. So when ever you write client side code you have to keep browser compatability in your mind and you have to code. Server Side code works with Web Server (IIS) and it's ASPNET ISAPI's. The won't directly communicate with each other. But using AJAX you can all server side code from Client Side! Example article on Ajax@ http://www.devarticles.com/index2.php?option=content&task=...

Client-Side scripting vs Server-Side scripting
hello I need an article that spaeks about Client-Side scripting vs Server-Side scripting,and when i need to use one of them thank you for the help and for the time here are some good links to a bunch of articles on that subject...

Difference between client side scripting and server side scripting
Hi,      Can u  plz, explain why the server side scripting is necessary, inorder to write the client side scripting. What is the main difference between the client side scripting and server side scripting. Client-side scripting is code that is executed on the client side, such as JavaScript. Server-side scripting is code that is executed on the server, such as VB, VB.NET, C#, or J#. For a better definition of server-side scripting and when it's necessary, please visit http://en.wikipedia.org/wiki/Server-side_scriptingRyan OlshanASPInsider | Microsoft MVP...

How to call a client side script from a server side script?
Hi guys, I have a Button1_Click function which gets executed on the server side as soon as Button1 is clicked. I have a client side function, test, which is  written in vbscript. I need to call this test function from the Button1_Click function. Can anyone of you please tell me how to do this? The test function is inside an asp:content tag (Please excuse my terminology if I am wrong, I am new to all this).  Thanks and Regards, RJ Have you tried to use the below code Button1.Attributes.Add("onclick","test()"); HCHaissam Abdul MalakMCAD.NET| Blog | Yes, ...

client side script Vs Server side Script
Which is better ? Using Client Side validations with Java Script or Using Server Side validation controls provided in asp.net You should use both... Client-side for a rich user experience and server-side to support browsers without javascript support or with javascript turned off....

Call server-side script from client-side script
Hi to all, I would like to ask you How can i call from client-side script a server-side script and to have the result from the server-side script in the client-side script. For example, i wand to call a function writing in server-side (DynaScript) script from a client-side script (JAVASCRIPT) and to have an answer from the function. Thanks in advance. Nick, One way that you could get round this is to write your client script code as you would server script eg. <SCRIPT language=javascript> function getValue()... would be written as: <% psDocument.WriteLn(&...

Acessing Variable, declared in the client side script, from the server side script
I'd like to know how can I use variables declared in the client side script from the server side script. Thanks! You cannot. The only way is to pass them as arguments to the server-side script. -- Larry Cermak [Team Sybase] Corporate Technology Partners EAServer Training & Consulting Coming Soon: Web DataWindow Book Web DataWindow Articles: http://my.sybase.com/detail?id=1003371 "Jeong-Su, Hwang" <hjs@i4biz.co.kr> wrote in message news:s9YmFSfKAHA.201@forums.sybase.com... > I'd like to know how can I use variables declared in the cl...

Acessing variables, declared in the server side script, from the client side script
I'd like to know how can I use variables declared in the server side script from the client side script. P.S.: I'm using JavaScript in the server side script and in the client side script. I don't like to use ASP. Thanks! One example that come to mind: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content="text/html; charset=windows-1252" http-equiv="Content-Type"> <META name=GENERATOR content="MSHTML 5.00.2919.6307"> <SCRIPT language=JavaScript> ...

Client vs. Server Side AJAX.Net
I am curious to know what the advantages and disadvantages are to using the client side declarative style AJAX controls vs. the server side.  I can't seem to think of too many reasons why I would go to the client side libraries when I can use all the power of ASP.NET (debugging, compiling, controls) and just wrap them in a UpdatePanel.   It also seems kind of counter productive to use the client side libraries because they don't utilize all the cool new developments of ASP.NET.  Am  I missing something?  Do the client AJAX libraries give you m...

Assigning Session from .NET to client-side script
hi, I am wondering how to assign a Session as a variable to client-side script (javascript)?? I am trying to pass a page URL (eg. current.aspx) to a javascript like (Close) when this button is clicked. My code as follow, but it done'st really work ... ================================================== <%@ Page Language="VB" %> <script runat="server"> sub page_load(ByVal sender As System.Object, ByVal e As System.EventArgs) session("link") = "current.aspx" end sub </script> <html&...

good book for client side scripting in .net?
Anyone come across a good book that concentrates on client side scripting./javascript for asp.net? Or at least a book that has devoted a fair bit of it's pages to this topic? I have the MSPress book, Developing Microsoft® ASP.NET Server Controls and Components. While there are quite a few references to client-side functionality, there is only one dedicated chapter. And that chapter is a mere 20 pages. Bearing in mind that ASP.NET is a server-side technology, I doubt you will find a book that concentrates on its client-side scripting aspect. After all, there's only a few ways...

How to write data to a file in client side using javascript or someother client side scripting language.
Hi, I would like to know how to write a data to a client side file using javascript or someother client side scripting language. The file type expected is ini file. txt file would also be appreciable. Thanks in advance.   If the site is a trusted and you are running IE then you could try http://www.w3schools.com/asp/asp_ref_filesystem.asp The Old Sewing FactoryThat twitter nonsense. You can write to the server, but not to the client's machine.  Being able to do so would be a huge security breach.When you ask a question, remember to click "mark as answered"...

Web resources about - Client side script for ImageButton - asp.net.ajax-ui

Hottest 'android-resources' Answers - Stack Overflow
current community chat blog Stack Overflow Meta Stack Overflow Stack Overflow Careers your communities Sign up or log in to customize your list. ...

Short Circuits and Infinite Loops
I was able to get the Android client up and running last night. It's a fairly simple affair, since I am definitely an Android GUI newbie, but ...

Image view with long press hint
Image view with long press hint - Gist is a simple way to share snippets of text and code with others.

ButtonExtensions Module
AddConfirmation() This Extension Method extends the Button, ImageButton, and LinkButton by adding a JavaScript confirmation dialog that appears ...

Wazapp for Nokia N9 gets major update. Bumped to version 0.9.12.
It has been long since we covered some Nokia N9 related news on our blog. But can’t resist reporting this. Wazapp the fruit of hard work put ...

Java AWT - Real's HowTo
Real's HowTo Custom Search Java Language String and Number Applet AWT Swing Environment IO Javascript interaction JDBC Thread Networking JSP ...

Android ListView with custom layouts tutorial
private void updateList(final ArrayList items){ listLayout.removeAllViews(); LayoutInflater inflater = getLayoutInflater(); if (items.size() ...

Resco releases two new, imaging-related controls
... that want a graphical button like the ones found in Palm OS applications) will be delighted to hear about Resco’s new controls. The ImageButton ...

WinCDEmu - Opens ISO and CD/DVD Images
Do you know what ISO files are? How about CUE, NRG, MDS/MDF, CCD, or IMG files. These are CD or DVD image files and they can be opened if you ...

Recipes - Xamarin
Xamarin Menu Products Xamarin Platform C# on iOS, Android, Mac & Windows Xamarin Test Cloud Test any app on hundreds of devices Xamarin University ...

Resources last updated: 11/27/2015 7:33:41 AM