.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Passing multiple arguments from a listview to a JavaScript function

Posted By:      Posted Date: October 16, 2010    Points: 0   Category :ASP.Net

Hello, I have been stuck on how to pass multiple to a JavaScript function in a item template of a list view. Below is my code. Does anyone know the process? Thank you.


                            <td style="width: 114px; height: 139px;">

                                <div style="width: 105px; height: auto">

                                    <img alt="" id="Image7" runat="server" src='<%# DataBinder.Eval(Container.DataItem,"images")%>'

                                        width="100" height="125" border="0" onmouseover='"javascript:show(<%# DataBinder.Eval(Container.DataItem,"images")%>)","(<%# DataBinder.Eval(Container.DataItem,"filename")%>)","(<%# DataBinder.Eval(Container.DataItem,"caption")%>)",1,234'

View Complete Post

More Related Resource Links

Passing value from asp to javascript function


Here is the problem 

private void Page_Load(object sender, System.EventArgs e)

private void Page_Load(object sender, System.EventArgs e)




                                      int flag = 1;

                                       btn_ModifyApprove.Attributes.Add("onClick", "return ValidateModifyApproval('" + Flag + "');

Passing an array to Javascript function, and SetTimeout

Hi, I have a js function that takes an array (of strings) as a parameter. I read some data from DB and create the a parameter and pass it to js function but it only sees the first entry. Here is the sample ( i cut out unnecessary stuff):var singletext = new array();function ns6scroll(singletext) { setTimeout("ns6scroll(" + singletext + ")", spause); } In code behind: string[] saAlerts = new string[lsAlerts.Count]; int i = 0; foreach (DMSAlertDO oAlert in lsAlerts) { StringBuilder sbAlert = new StringBuilder(); sbAlert.Append("'<nobr align=\"center\">"); if (oAlert.NavigateUrl != string.Empty) sbAlert.Append("<a target=\"_blank\" class=\"scroller\" href=\"" + oAlert.NavigateUrl + "\">" + oAlert.AlertText + "</a></nobr>'"); else sbAlert.AppendFormat("{0}</nobr>'", oAlert.AlertText); saAlerts[i++] = sbAlert.ToString(); } if (!ClientScript.IsStartupScriptRegistered("StartScroller")) { StringBuilder sbScript = new StringBuilder(); sbScript.AppendFormat("<scr

SharePoint - Passing Dataview Row Arguments to a C# function from a button

RE: SharePoint - Passing Dataview Row infomration to a C# function I've done this with a asp.net Gridview. but does anybody have any examples on how to pass row information from an asp.net button in  SharePoint Dataview rows to an inline C# function? the button Repeats as follows: <asp:Button runat="server" Text="Delete" id="Delete{@ID}"  OnClick="DeleteDoc()"/> My function looks like this: void DeleteDoc(object sender, EventArgs e) { } I tried adding another parameter but get: No overload for 'DeleteDoc' matches delegate 'System.EventHandler' Thank you.

passing repeater container.dataitem to javascript function

I am collecting user roles into a single dimension string array. I have a repeater that its source set to that array. The repeater template includes list of checkboxes for the values in the array.The checkbox text is set to: Text='<%# Container.DataItem %>'All is good till this point.But I am trying to call a javascript function triggered by clickign a checkbox and pass it the container.dataitem, but the javascript doesn't seem to be reading the value and either complain about string not being in correct format or that treats the container.dataitem as a liter. This is the trial that didn't work (I tried many different things too):DetermineVal(<%# DataBinder.Eval(Container.DataItem) %>);determineval is my javascript functionCan I do that with a single dimension array?thank you in advance

Passing invisible element to javascript function


I want to pass the name of a listbox to a javascript function which will make it visible. The listbox element must start out invisible. But when the server generates the source, it does not create the element because it is invisible. So the javascript functions doesn't get anything. How to do this?

    function promote(boxid) {
        document.getElementById(boxid).style.visibility = "visible";
        document.getElementById(boxid).style.zIndex = 100;


    <asp:ListBox ID="ListBox1" runat="server" CssClass="PosAbs0" Visible="False"
        SelectionMode="Multiple" ToolTip="Ctrl-Click to select multiple items">
        <asp:ListItem Selected="True">All Breed</asp:ListItem>

Passing grid DataItem as an argument to javascript function.


in aspx page

<cmp:MenuItemInfo Text="Delete" onclick="javascript:deleteRow('## DataItem.ClientId ##')" />


In Javascript


function deleteRow(rowId)




but the arument is coming as a string '## DataItem.ClientId ##' instead of correct clientID.

Any help ?


Content page control passes as argument to javascript function


Here is the content page:


<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="JavaDynamicCopyValue.aspx.cs" Inherits="JavaDynamicCopyValue" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
 <script type="text/javascript" >
 function copyValue(input, output )
   ouput.value = input.value;
   return true;
 <asp:TextBox ID="txt1" runat="server" onchange="copyValue(this,document.getElementById('<%=txt2.ClientID%>'))"></asp:TextBox>
    <br />
    <br />
    <asp:TextBox ID="txt2" runat="server"></asp:TextBox>


I got a javascript run time error says output is undefined. if I view source of the page, the txt1 markup became:

<input name="ctl00$ContentPlaceHol

way of calling "javascript function of parent window from child window."

The article way of calling "javascript function of parent window from child window." was added by raja.s on Sunday, June 06, 2010.

Hi,Here i am going to explain how to call the javascript function of a parent window from the child window(pop-Up).Some may know before reading this post.Parent Java Script Function:script language="Javascript" type="text/javascript">

>>>How to use javascript function in aspx file?



I have a file util.js and there some funtions in same file.

For example functions name are keyUp, keyDown, isNumeric, isAlphaNumeric

I have used these functions in aspx code behind in a textbox to restrict user that he may not be able to input any special character.

Before, I used the code directly in aspx file but I have do it for different textboxes therefore to avoid much coding in aspx file I created util.js and put all code in this file but how to use these particular functions in aspx file I couldn't find the way.

Anyone have idea. Do share with me.

I used the reference like this:


' Font-Names="Verdana" Font-Size="8pt" Onkeyup= "keyUp(event.keyCode)" Onkeydown="return isAlphaNumeric(event.keyCode);" onpaste="return false;">

using single function to open multiple colorbox


Hi I have li like this

<li class="game">
                                    <div class="game-thumb">
                                        <a href="include/games/words.swf" class="gamelink">
                                            <img src="include/games/words.jpg" /></a></div>
                                    <div class="thumb-desc">
                                <li class="game">
                                    <div class="game-thumb">
                                        <a href="include/games/cat.swf" class="game2">
                                            <img src="include/games/dots.jpg" /></a></div>
                                    <div class="thumb-desc">
                                        Trap the CAT</div>
                                <li class="game">
                                    <div class="game-thumb">
                                        <a href="include/games/gravitymaster.swf" class=&qu

SharePoint Blog - Admin web part - newBlogPostOnClient JavaScript function


In the Admin Links web part in a default blog site, there are several links, the last one of which launches Microsoft Word and allows you to manage your posts from the Word blog template.  Cool feature.  But that web part is not configurable and I can't figure out how to duplicate that functionality.  It appears to have 3 GUIDS that are part of the function, part of the last parameter looks like the Posts list GUID, but it is concatenated with another GUID.   I want to either create my own web part or modify the XSL of the page to call the function, but I'm not sure what those other GUID parameters are.  Does anyone know?  The last one seems to be two of the separated by the # character.


Run a javascript function after UpdatePanel.Update()


I thought that adding the javascript within the ContentTemplate would cause it to run every time the UpdatePanel was updated.  For example, I would assume that for the following:

<atlas:UpdatePanel ID="UpdatePanel1" runat="server" Mode="Conditional" >
        Hello from inside the update panel!!!!
        <asp:Button ID="foo" runat="server" OnClick="foo_Click" Text="Click me to postback!" />
        <script type="text/javascript">alert('Javascript, baby!');</script>

 would cause the function alert() to run every time the UpdatePanel returns from the button click.  This is not the case, however.

How do I do this?  My update panel contains a scrolling Div and I

Accessing Label Control In a listview using Javascript



I have a Button and Label nested inside a ListView.

When a User clicks the button i want the Label to display a specific value eg"Pass". Of course being a Listview the Label value will be relevant to the row the button was clicked on.

I want all this to happen on client side, but i am struggling to access the Label via my Javascript??

Any suggestions and examples Would be much appreciated..

javascript function not working with datalist


I have a datalist and there is a check box within this datalist in a .ascx page.  But I have to have an image out side the datalist.  So here is the code and its not owrking.  When I click on the image, I dont see any alert box. 


<script Language="JavaScript" type="text/javascript">


function validate_checkbox()



// set var checkboxSelect to zero

var checkboxSelect = 0;

var sProducts = "";


var multiCheck = window.document.forms["frmCompare"].CompareCheck.length;


if (multiCheck != null)


    // Loop from zero to the one minus the number of checkbox button selections

    for (counter = 0; counter < window.document.forms["frmCompare"].CompareCheck.length; counter++)


        if (window.document.forms["frmCompare"].CompareCheck[counter].checked)


            var seperator = (checkboxSelect > 0)?",":"";

            sProducts += sep

Help Passing Multiple Parameters Via a URL in SSRS 2008

Hello Everyone, I'm totally and completely confused as to how to pass multiple paramters through a URL.  Book Online is absolutely no help because they do not offer any examples of passing multiple paramters within a URL.  Instead, I get confused over RENDER and COMMAND and what should be repeated where with each paramter and on and on and on. Here's my URL: javascript:void(window.open('http://sereporting01.wdig.com/ReportServer?%2fDOL%2fTEST%2fDisney+Sell-Through&rs:Command=Render&SiteName=Disney,InsertionType=300 x 250,Context=ROS','_blank','resizable=yes,toolbar=0,menubar=0')) What happens is that JavaScript opens a new window but I get a "Reporting Services Error".  I'm assuming it's because my URL parameters are not correct.  Can someone please just give me the correct syntax so that I can get on with my work? I'm editing this post to add - I'm also confused as to how paramters are supposed to be passed through to a report when default paramters are set up in the report which i'm trying to open with the URL.  Should I remove the default paramaters from the report or...what? Again, BOL offers no help on this issue and it just seems to generate more questions.  Thanks!!  

Passing Multiple Parameters in NavigateURL Property of Hyperlink

In ASP.NET 3.5, is this the only way to pass Multiple Parameters in NavigateURL Property of Hyperlink ? What about using the HyperlinkField?<asp:TemplateField HeaderText="Form Name">    <ItemTemplate>        <asp:HyperLink ID="HyperLink2" runat="server"         NavigateUrl='<%# "~/Application/" + Eval("FormType") + ".aspx?FormID=" + Eval("FormID") %>'         Text='<%# Eval("FormName") %>'>                </asp:HyperLink>     </ItemTemplate></asp:TemplateField>

calling a javascript function within aspx

i have a js method i wrote myself called sumAlert();  i want to call it in my aspx like this, when a user clicks on a button<asp:Button ID="Button" runat="server" Text="Submit" OnClientClick="if (confirm('WARNING! You will be unable to save again if you proceed')) sumAlert();"                        OnClick="Button_Click" />How can i get it to call the function if the user confirms OK?
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend