2

this is another question that I want to know that how to apply any jQuery function on onclick() event of Linkbutton.

I have a one Linkbutton and I want to set below jQuery function when linkbutton is clicked.

<önclick="TINY.box.show({
    iframe:'User_News.aspx',
    boxid:'frameless',
    width:250,
    height:250,
    fixed:false,
    maskid:'bluemask',
    maskopacity:40,
    closejs:function(){closeJS()}
})"
style="color: #0000FF; font-size: medium; height: 28px;"
id="l1" 
runat="server">

This function gives me a popup message. So how to get this popup when linkbutton is clicked?

3
  • That doesn't even look like a valid tag, are you sure your code does anything? Commented Jun 28, 2012 at 4:47
  • i have same like <li onclick="TINY.box.show({iframe:'User_News.aspx',boxid:'frameless',width:250,height:250,fixed:false,maskid:'bluemask',maskopacity:40,closejs:function(){closeJS()}})" style="color: #0000FF; font-size: medium; height: 28px;" id="l1" runat="server">View Message </li> Commented Jun 28, 2012 at 4:48
  • yes. i am using the .net with c#. Commented Jun 28, 2012 at 5:14

2 Answers 2

3

You can bind the javascript function to linkbutton and it will show popup on click

<asp:LinkButton id="lnk" runat="server" OnClientClick="ShowPopUp();">

if you have linkbutton as id you can use jquery to bind script

$('#linkbutton').click(ShowPopUp);

if you have linkbutton as class you can use jquery to bind script

$('.linkbutton').click(ShowPopUp);  


function ShowPopUp(){
  TINY.box.show({
  iframe:'User_News.aspx',
  boxid:'frameless',
  width:250,
  height:250,
  fixed:false,
  maskid:'bluemask',
  maskopacity:40,
  closejs:function(){closeJS()}
  });
}
Sign up to request clarification or add additional context in comments.

12 Comments

On which statement you get error and what is the error? Are you using asp.net ?
when i am writing this code in Script Function. and javascript function not work.
On which statement you get error and what is the error? Are you using asp.net ?
yes sir. i am using c#.and when i call that function it does not work.
c# does not mean that you are using asp.net. I want to know if you are using asp.net ?
|
1

include jquery library - https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js

Considering Linkbutton as classname add this in Script tag -

$(function(){
  $('.Linkbutton').on('click', function(){
    $('#frameless').show();
  });
});

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.