Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have imagebutton, button1 and button2 placed as items on a template of a datalist.

I have a function Load(url){....}

I called this function : onclientclick="retuen Load(this.value);" of button 1.
So when we click button1 then called load(url) function.

It is working properly.

I need to pass another parameter as button2.value.
I normally wrote as onclientclick="return Load(this.value,button2.value);"
But it is not working.

How can pass this value?
Posted
Updated 13-Apr-11 21:35pm
v4
Comments
Dalek Dave 14-Apr-11 3:35am    
Edited for Grammar and Readabiliy.

try this Link

Click here[^]
 
Share this answer
 
Comments
Dalek Dave 14-Apr-11 3:35am    
Good Link
Update your function Load(url1, url2).

On your clientclick code, try this
onclientclick="return Load(this.value,document.button2.value);"
Your client click event should work.

OR

do something like this.

button 1
<br />
onclientclick="return Load('<%=button1.ClientID%>','<%=button2.ClientID%>');"<br />


then change your Load function to

function Load(btn1, btn2) {
   var btn1Value = document.getElementById(btn1).value;
   var btn2Value = document.getElementById(btn2).value;
}


Good luck!
 
Share this answer
 
v5
Comments
vipinsethumadhavan 14-Apr-11 2:43am    
No. I also changed number of parameters. That is not.
when I call asonclientclick(this.value) --- working
same time when I call asonclientclick(Button1.value) ---not working
Pong D. Panda 14-Apr-11 2:48am    
what do you want to attain on your Button1.value? remember that is case sensitive, do you have the right casing? what's the error? Check my updated solution. Good luck!
vipinsethumadhavan 14-Apr-11 7:26am    
Button value is bind value. video file name.
Dalek Dave 14-Apr-11 3:35am    
Good Answer.
vipinsethumadhavan 14-Apr-11 7:24am    
NO nothing happening .
My datalsit as below
<asp:DataList id="DLAudios" runat="server" RepeatColumns="1" CellPadding="0" __designer:wfdid="w40"><itemtemplate>
<TABLE><TBODY><TR><TD style="WIDTH: 100px"><DIV class="imageouterdiv"><DIV class="imageinnerdiv"><asp:ImageButton style="LEFT: 0px; BACKGROUND-IMAGE: url(../images/play.jpg); CURSOR: pointer; TOP: 2px" id="ImageButton1" runat="server" CssClass="imageinnerdiv" ImageUrl='<%# "~/SermonsGallery/Photos/" + Eval("Video_Imgname") %>' ToolTip="Click to view." CommandName="Select" OnClientClick="return LoadDiv(Button2)" __designer:wfdid="w44"></DIV></DIV></TD></TR><TR><TD style="WIDTH: 100px" align=center><asp:Button style="BACKGROUND-IMAGE: url(images/play.jpg)" id="Button2" runat="server" CssClass="logbutton" Width="46px" Height="29px" Text='<%# Eval("Video_Name") %>' ToolTip="Click To Play" CommandName="bb" Font-Overline="False" Font-Size="XX-Small" ForeColor="#1C95DA" OnClientClick="return LoadDiv(this.value)" __designer:wfdid="w45"> </TD></TR></TBODY></TABLE>


-***** scripit
function LoadDiv(url)
{
alert(url);
var btn1Value = document.getElementById(url).value;
alert(btn1Value);
}
*------* Here only working is when click on button onclientclick(this.value). Other image button has no response

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900