Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. call a c# funcation in html code

call a c# funcation in html code

Scheduled Pinned Locked Moved ASP.NET
questioncsharphtmlhelp
20 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Gamzun

    call function2 from function1 which is defined in onclick

    S Offline
    S Offline
    saurabh8april
    wrote on last edited by
    #3

    there are various pages in my ERP, i have a search panel, which is displayed according to the pages. i can not use all those funtion in js, as i have to hide and show various textboxes and button. Can there be any other event,on the HTML Link to call the functions according to the page. i have done that with asplinkbutton...but i m using now an expandable menu. which does not work if i use asplinkbutton.

    G 1 Reply Last reply
    0
    • S saurabh8april

      there are various pages in my ERP, i have a search panel, which is displayed according to the pages. i can not use all those funtion in js, as i have to hide and show various textboxes and button. Can there be any other event,on the HTML Link to call the functions according to the page. i have done that with asplinkbutton...but i m using now an expandable menu. which does not work if i use asplinkbutton.

      G Offline
      G Offline
      Gamzun
      wrote on last edited by
      #4

      did you try adding attribute to the link from code behind and assigning desired function name?

      S A 2 Replies Last reply
      0
      • G Gamzun

        did you try adding attribute to the link from code behind and assigning desired function name?

        S Offline
        S Offline
        saurabh8april
        wrote on last edited by
        #5

        Gamzun,thanks buddy....... can u tell me 1 thing, when i use the asplinkbutton in plcae of html link in the collapsible menu, the collapsible property of it stop working.if i can slove this problem.......all other headache will end. Thanks again.

        1 Reply Last reply
        0
        • G Gamzun

          did you try adding attribute to the link from code behind and assigning desired function name?

          A Offline
          A Offline
          angle57
          wrote on last edited by
          #6

          [Message Deleted]

          S 1 Reply Last reply
          0
          • A angle57

            [Message Deleted]

            S Offline
            S Offline
            saurabh8april
            wrote on last edited by
            #7

            angle, can u show me the code, so that i can get a clear view how to use it. Thanks Saurabh

            G 1 Reply Last reply
            0
            • S saurabh8april

              angle, can u show me the code, so that i can get a clear view how to use it. Thanks Saurabh

              G Offline
              G Offline
              Gamzun
              wrote on last edited by
              #8

              Saurab, I didn't get your scenario properly what exactly you're trying to do. What I'm assuming is that you've a search panel which is displayed where ever you navigate to but it shows controls according to the page you're on. Is this your scenario?

              S 1 Reply Last reply
              0
              • G Gamzun

                Saurab, I didn't get your scenario properly what exactly you're trying to do. What I'm assuming is that you've a search panel which is displayed where ever you navigate to but it shows controls according to the page you're on. Is this your scenario?

                S Offline
                S Offline
                saurabh8april
                wrote on last edited by
                #9

                yes ,dear...............

                G 1 Reply Last reply
                0
                • S saurabh8april

                  yes ,dear...............

                  G Offline
                  G Offline
                  Gamzun
                  wrote on last edited by
                  #10

                  then why are you calling particular function on menu click, instead of that why don't you set search panel controls from page's load event?

                  S 1 Reply Last reply
                  0
                  • G Gamzun

                    then why are you calling particular function on menu click, instead of that why don't you set search panel controls from page's load event?

                    S Offline
                    S Offline
                    saurabh8april
                    wrote on last edited by
                    #11

                    i have used,iframe and my page is divided into two parts..left and right. left i have fixed,where i display the search panel and in the right panel, the page loads(in iframe). thus keeping the main page stable and loading the page and search panel in side that main page. the main page contains all the attributes of search panel. can u help me,with using asplinkbutton instead of html link. as i told u before, when i used it....1st page on click works fine along with search panel and after which the collapsiable proerty stop,until the main page is refreshed. so, if i can use the asplinkbutton......all the problems will be sloved in the collpsiable menu. thanks in advance dear......

                    G 1 Reply Last reply
                    0
                    • S saurabh8april

                      i have used,iframe and my page is divided into two parts..left and right. left i have fixed,where i display the search panel and in the right panel, the page loads(in iframe). thus keeping the main page stable and loading the page and search panel in side that main page. the main page contains all the attributes of search panel. can u help me,with using asplinkbutton instead of html link. as i told u before, when i used it....1st page on click works fine along with search panel and after which the collapsiable proerty stop,until the main page is refreshed. so, if i can use the asplinkbutton......all the problems will be sloved in the collpsiable menu. thanks in advance dear......

                      G Offline
                      G Offline
                      Gamzun
                      wrote on last edited by
                      #12

                      where's your collapsible panel located? is it on main page or page?

                      S 1 Reply Last reply
                      0
                      • G Gamzun

                        where's your collapsible panel located? is it on main page or page?

                        S Offline
                        S Offline
                        saurabh8april
                        wrote on last edited by
                        #13

                        my menu is placed on the left panel of main page. left panel is divided into two parts upper: have search panel lower : has menu.

                        G 1 Reply Last reply
                        0
                        • S saurabh8april

                          my menu is placed on the left panel of main page. left panel is divided into two parts upper: have search panel lower : has menu.

                          G Offline
                          G Offline
                          Gamzun
                          wrote on last edited by
                          #14

                          well lets try this, add html link with attribute runat='server' then try.

                          S 1 Reply Last reply
                          0
                          • G Gamzun

                            well lets try this, add html link with attribute runat='server' then try.

                            S Offline
                            S Offline
                            saurabh8april
                            wrote on last edited by
                            #15

                            Gamzun, i have tried this out, but there was no event on which i can call the function.If you can help me with restoring the property of the menubar after i have used asplinkbutton.

                            G 1 Reply Last reply
                            0
                            • S saurabh8april

                              Gamzun, i have tried this out, but there was no event on which i can call the function.If you can help me with restoring the property of the menubar after i have used asplinkbutton.

                              G Offline
                              G Offline
                              Gamzun
                              wrote on last edited by
                              #16

                              I don't prefer using asp menubar, however, can you workaround with the help of querystring?

                              S 1 Reply Last reply
                              0
                              • G Gamzun

                                I don't prefer using asp menubar, however, can you workaround with the help of querystring?

                                S Offline
                                S Offline
                                saurabh8april
                                wrote on last edited by
                                #17

                                Gamzun, no its not an asp menu bar.........but i used it before(asp link button) where i had 'onclick' and 'onclientclick' events, from which i called the page from one and corresponding search panel with another one. now in case of html menu,i just have 'onclick' event. i call the page using js,where as my search panel is called from c# code. i m unable to manage both on one click event... :(

                                G 1 Reply Last reply
                                0
                                • S saurabh8april

                                  Gamzun, no its not an asp menu bar.........but i used it before(asp link button) where i had 'onclick' and 'onclientclick' events, from which i called the page from one and corresponding search panel with another one. now in case of html menu,i just have 'onclick' event. i call the page using js,where as my search panel is called from c# code. i m unable to manage both on one click event... :(

                                  G Offline
                                  G Offline
                                  Gamzun
                                  wrote on last edited by
                                  #18

                                  okie picture is clear now, try calling this on html links onclick='__doPostBack('method name to be called on postback','in arguments you can send id of page or something by which you can get which link is click! ' In your main page's code-behind, the method which is defined in __doPostback, set your search panel accordingly and open the page as per argument send by request.form['__EVENTARGUMENT'] (i might be wrong about this request.form's parameter just google how to get the value from it) and you're good to go :) let me know if you need further help

                                  Please don't forget to mark 'Good Answer', if you find it really a good one! Kashif

                                  S 1 Reply Last reply
                                  0
                                  • G Gamzun

                                    okie picture is clear now, try calling this on html links onclick='__doPostBack('method name to be called on postback','in arguments you can send id of page or something by which you can get which link is click! ' In your main page's code-behind, the method which is defined in __doPostback, set your search panel accordingly and open the page as per argument send by request.form['__EVENTARGUMENT'] (i might be wrong about this request.form's parameter just google how to get the value from it) and you're good to go :) let me know if you need further help

                                    Please don't forget to mark 'Good Answer', if you find it really a good one! Kashif

                                    S Offline
                                    S Offline
                                    saurabh8april
                                    wrote on last edited by
                                    #19

                                    lol.......Kashif, sure i will.......... :) let me try once

                                    1 Reply Last reply
                                    0
                                    • S saurabh8april

                                      how do i call a c# funcation in html code, on link's onclick? i have already called a function onclick, i need to call another function. kindly help me out....

                                      A Offline
                                      A Offline
                                      April Fans
                                      wrote on last edited by
                                      #20

                                      Hi, You can try this: (1) JS: PageMethods. backmethod (latlng,myCallBack); (2) C# [System.Web.Services.WebMethod]//you must write this; public static String backmethod (Object xingcan)//must be static { …… //your logic } (3) function myCallBack(result) { var di = document.getElementById("Label1"); //for example di.innerText=result; } The order is (1)-(2)-(3)。

                                      April Comm100 - Leading Live Chat Software Provider

                                      1 Reply Last reply
                                      0
                                      Reply
                                      • Reply as topic
                                      Log in to reply
                                      • Oldest to Newest
                                      • Newest to Oldest
                                      • Most Votes


                                      • Login

                                      • Don't have an account? Register

                                      • Login or register to search.
                                      • First post
                                        Last post
                                      0
                                      • Categories
                                      • Recent
                                      • Tags
                                      • Popular
                                      • World
                                      • Users
                                      • Groups