JQuery UI Button

Hi All,
I added the JQuery UI Buttonset on my page
     <div class="pageUtils">
                    <button>
                        Back</button>
                    <button>
                        Next</button>
                    <button>
                        Save</button>
                    <button onclick="PrintInvoke()">
                        Print</button>
                    <button>
                        Glossary</button>
                </div>
And I add the ICONS to the BUttonSet using

    <script type="text/javascript">
        $(function() {
            $(".pageUtils button:first").button({
                icons: {
                    primary: 'ui-icon-triangle-1-w'
                },
                text: false
            }).next().button({
                icons: {
                    primary: 'ui-icon-triangle-1-e'
                },
                text: false
            }).next().button({
                icons: {
                    primary: 'ui-icon-disk'
                },
                text: false
            }).next().button({
                icons: {
                    primary: 'ui-icon-print'
                },
                text: false                
               
            }).next().button({
                icons: {
                    primary: 'ui-icon-lightbulb'
                },
                text: false
            });
        });
    </script>

Now, I need to perform a few actions including calling a Modal Popup Container, and collapse/uncollapse a few panels based on a DB value. I am able to do them if I replace the Jquery button with normal asp.net button [doing away with these icons]…

I was wondering if I can do something that would make JQuery button behave as a asp.net button for a click event…[ Postback the page and calling a specific function][currently I am only able to assosiate client site funtions]…Alternatively …

Can I add these icons to the ASP.NET Image Button during the run time…

Please let me know in case you require more information…










sraghu4Asked:
Who is Participating?
 
rhodesbConnect With a Mentor Commented:
Sorry for the late reply.  Here is an example like you asked for:

Create another asp.net page that only grabs the value you want from the database, then writes it out (and writes out nothing else including html like <head><body> etc.).

Then call that page with an AJAX function when you click the button.  <-- JQuery code below for accomplishing this
$(function(){
  // Register a click handler for your button
  $("#buttonID").click(function(){
    // load the database value into some container <-- I'll call it containerId
    // from a different .aspx page that gets the value you need, then writes it out <-- I'll call it dbLookup.aspx
    // and call a function after the server response <-- I'll call it responseHandler()
    $("#containerId").load("http://yoursite.com/dbLookup.aspx", responseHandler);
  });

  function responseHandler(response){
    // Here response will hold the database value that you get back from your other page (dbLookup.asps)
    // or you can get the value from the container you stored it in ($("#containerId").val() 
    // or $("#containerId").html()
    // Then you just need to run the functions that you said are already working with that value
  }
});

Open in new window

0
 
lluthienCommented:
if you are just looking for a way to call a method on the server,
try just giving the button a serverside event (onclick)
and in the jquery -clientside- clickevent just return false to stop the event from happening
0
 
rhodesbCommented:
If all you need is a value from the db, you can do it without a page refresh by using an AJAX call to a server-side script.  Since you're using JQuery already, you can use $.ajax() or $().load() in the Jquery library to make your life a bit easier.
0
 
sraghu4Author Commented:

Thanks a lot for all your response.

I wasn't sure how i should be doing what you said. [PS : how to give this button a server side event ], if this is something that can be done ? It would be helpful if you could give me an example.








0
 
sraghu4Author Commented:
Thanks
0
All Courses

From novice to tech pro — start learning today.