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. hiii.. how can i call modal popup through code behind ...

hiii.. how can i call modal popup through code behind ...

Scheduled Pinned Locked Moved ASP.NET
helpjavascriptquestion
7 Posts 2 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.
  • H Offline
    H Offline
    hi_everybody
    wrote on last edited by
    #1

    actualy, i want to give data for modification in the modal popup. but after filling info through code behind i want to call showmodal()method(which is in javascript )through scriptmanager. jst like this, 'ScriptManager.RegisterStartupScript(frmtest, frmtest.GetType, "clientScript", "showTestModal('mpe');", True)' but at it shows an error of 'null' means,it didn't find the behaviour id of modalpopup extender. then i tried to add attribute at page load method for button, like this, btnMod.Attributes.Add("onclick", "showModaltest('mpe');") this time it shows modal popup but immediately modal popup get closed automatically. plz help me i need it urgently.....

    P 1 Reply Last reply
    0
    • H hi_everybody

      actualy, i want to give data for modification in the modal popup. but after filling info through code behind i want to call showmodal()method(which is in javascript )through scriptmanager. jst like this, 'ScriptManager.RegisterStartupScript(frmtest, frmtest.GetType, "clientScript", "showTestModal('mpe');", True)' but at it shows an error of 'null' means,it didn't find the behaviour id of modalpopup extender. then i tried to add attribute at page load method for button, like this, btnMod.Attributes.Add("onclick", "showModaltest('mpe');") this time it shows modal popup but immediately modal popup get closed automatically. plz help me i need it urgently.....

      P Offline
      P Offline
      PunkIsNotDead
      wrote on last edited by
      #2

      To show the modal in one event of the codebehind you only have to use:

      ControlWithExtender_ModalPopupExtender.Show();//Use the properties of the extender!

      is that what you need??

      H 1 Reply Last reply
      0
      • P PunkIsNotDead

        To show the modal in one event of the codebehind you only have to use:

        ControlWithExtender_ModalPopupExtender.Show();//Use the properties of the extender!

        is that what you need??

        H Offline
        H Offline
        hi_everybody
        wrote on last edited by
        #3

        actualy, i don't know much about handling modal popup i am new in asp.net.. so didn't get meaning of solution suggested by you... so i told u what i actualy want... i have asp table, its one column contains asp button when i click on that button i want to show all deatils of that row which contains that button in the modal popup and modify some data and click on save button which is in modal popup.afer saving the data which get modified should be display in the same row of asp table.... for that u set data if row to the controls which are in modal popup in codebehind but after setting data i want to show modal popup through code behind i through script manager as i told in previously but i shows an error of 'null' i tried that, to add the 'showmodal'(javascript function to show modal popup)as an attribute to that asp button it shows modal popup but get disappered immediatly automatically as i told previously.... do u got?wh i actualy want?... so plz help me, i need it urgently thanks & regards madhuri.... :)

        P 1 Reply Last reply
        0
        • H hi_everybody

          actualy, i don't know much about handling modal popup i am new in asp.net.. so didn't get meaning of solution suggested by you... so i told u what i actualy want... i have asp table, its one column contains asp button when i click on that button i want to show all deatils of that row which contains that button in the modal popup and modify some data and click on save button which is in modal popup.afer saving the data which get modified should be display in the same row of asp table.... for that u set data if row to the controls which are in modal popup in codebehind but after setting data i want to show modal popup through code behind i through script manager as i told in previously but i shows an error of 'null' i tried that, to add the 'showmodal'(javascript function to show modal popup)as an attribute to that asp button it shows modal popup but get disappered immediatly automatically as i told previously.... do u got?wh i actualy want?... so plz help me, i need it urgently thanks & regards madhuri.... :)

          P Offline
          P Offline
          PunkIsNotDead
          wrote on last edited by
          #4

          ok sorry for the delay! i was working ^^

          so, you need to show the modal when the user clicks on a row of a asp table?? isn't a Gridview?? with gridview is easier!

          well let's start from zero, if you're using ajax ModalPopUpExtender you can give the extensor to any asp control... like

          <cc1:ModalPopupExtender ID="MyModal" runat="server"
          Enabled="True" TargetControlID="MyTestButton"
          BackgroundCssClass="modalBackground"
          PopupControlID="Pnl_Modal"
          CancelControlID="Btn_Cancel" DropShadow="True">
          </cc1:ModalPopupExtender>

          and your panel to show must be hidden

          <asp:Panel style="display:none;" CssClass="modalPopup" ID="Pnl_Modal" runat="server" Height="99px" Width="297px"
          BackColor="#66CCFF">Here the textboxes you need and the save buttonasp:panel

          ok then! assuming you've a grid like

          <asp:GridView ID="GV_MyData" runat="server" AutoGenerateColumns="False"
          DataKeyNames="Id_Pelicula" DataSourceID="LQDS_MySource"
          onselectedindexchanged="GV_MyData_SelectedIndexChanged">
          <Columns>bla bla bla and your button in every row</Columns>
          </asp:GridView>

          so in the OnSelectedIndexChanged Event you can add

          MyTextBoxInsideTheModal1.Text = values.Actor_Estelar;
          MyTextBoxInsideTheModal1.Text = values.Titulo;
          MyModal.Show();

          assuming values is obtained from a qry using the SelectedDataKey.Value of the GV... i'm explaining myself?

          H 1 Reply Last reply
          0
          • P PunkIsNotDead

            ok sorry for the delay! i was working ^^

            so, you need to show the modal when the user clicks on a row of a asp table?? isn't a Gridview?? with gridview is easier!

            well let's start from zero, if you're using ajax ModalPopUpExtender you can give the extensor to any asp control... like

            <cc1:ModalPopupExtender ID="MyModal" runat="server"
            Enabled="True" TargetControlID="MyTestButton"
            BackgroundCssClass="modalBackground"
            PopupControlID="Pnl_Modal"
            CancelControlID="Btn_Cancel" DropShadow="True">
            </cc1:ModalPopupExtender>

            and your panel to show must be hidden

            <asp:Panel style="display:none;" CssClass="modalPopup" ID="Pnl_Modal" runat="server" Height="99px" Width="297px"
            BackColor="#66CCFF">Here the textboxes you need and the save buttonasp:panel

            ok then! assuming you've a grid like

            <asp:GridView ID="GV_MyData" runat="server" AutoGenerateColumns="False"
            DataKeyNames="Id_Pelicula" DataSourceID="LQDS_MySource"
            onselectedindexchanged="GV_MyData_SelectedIndexChanged">
            <Columns>bla bla bla and your button in every row</Columns>
            </asp:GridView>

            so in the OnSelectedIndexChanged Event you can add

            MyTextBoxInsideTheModal1.Text = values.Actor_Estelar;
            MyTextBoxInsideTheModal1.Text = values.Titulo;
            MyModal.Show();

            assuming values is obtained from a qry using the SelectedDataKey.Value of the GV... i'm explaining myself?

            H Offline
            H Offline
            hi_everybody
            wrote on last edited by
            #5

            its ok.... thanks for reply.. but i want asp table and i generate it dynamically so the asp button on which i want to show modal popup also generated dynamically... so how can i show modal popup on it..??? for testing i create one test.aspx like this...

            <%@ Page Language="VB" AutoEventWireup="false" CodeFile="test.aspx.vb" Inherits="test" %>

            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

            <html xmlns="http://www.w3.org/1999/xhtml" >
            <head runat="server">
            <title>Untitled Page</title>
            <script type="text/javascript" language="javascript">
            function onOk(){
            return true;
            }

            function ShowModalForNew(){
                var myBehavior = $find('mpe'); 
                myBehavior.show(); 
                $find('mpe').show; 
            }
            </script>
            

            </head>
            <body>
            <form id="form1" runat="server">
            <ACT:ToolkitScriptManager runat="server" ID="ScriptManager1" EnableScriptGlobalization="true" EnableScriptLocalization="true" />
            <div>
            <asp:UpdatePanel ID="uptmp" runat="server" UpdateMode="conditional">
            <ContentTemplate>
            <table>
            <tr>
            <td>
            <asp:Button ID="Button1" runat="server" Text="Button" />
            <a href="#" style="display:none;visibility:hidden;" onclick="return false" id="dummyLink" runat="server">dummy</a>
            </td>
            </tr>
            </table>
            <act:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
            TargetControlID="dummylink"
            popupcontrolid ="Panel1"
            backgroundcssclass="modalBackground"
            dropshadow="True"
            cancelControlId="CancelButton"
            BehaviorId = "mpe" />
            <asp:Panel ID="Panel1" runat="server" style="display:none; width:200px; background-color:White; border-width:2px; border-color:Black; border-style:solid; padding:20px;">
            Are you sure you want Delete Text?
            <br /><br />
            <div style="text-align:right;">
            <asp:Button ID="OkButton" runat="server" Text="OK" />
            <a

            P 1 Reply Last reply
            0
            • H hi_everybody

              its ok.... thanks for reply.. but i want asp table and i generate it dynamically so the asp button on which i want to show modal popup also generated dynamically... so how can i show modal popup on it..??? for testing i create one test.aspx like this...

              <%@ Page Language="VB" AutoEventWireup="false" CodeFile="test.aspx.vb" Inherits="test" %>

              <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

              <html xmlns="http://www.w3.org/1999/xhtml" >
              <head runat="server">
              <title>Untitled Page</title>
              <script type="text/javascript" language="javascript">
              function onOk(){
              return true;
              }

              function ShowModalForNew(){
                  var myBehavior = $find('mpe'); 
                  myBehavior.show(); 
                  $find('mpe').show; 
              }
              </script>
              

              </head>
              <body>
              <form id="form1" runat="server">
              <ACT:ToolkitScriptManager runat="server" ID="ScriptManager1" EnableScriptGlobalization="true" EnableScriptLocalization="true" />
              <div>
              <asp:UpdatePanel ID="uptmp" runat="server" UpdateMode="conditional">
              <ContentTemplate>
              <table>
              <tr>
              <td>
              <asp:Button ID="Button1" runat="server" Text="Button" />
              <a href="#" style="display:none;visibility:hidden;" onclick="return false" id="dummyLink" runat="server">dummy</a>
              </td>
              </tr>
              </table>
              <act:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
              TargetControlID="dummylink"
              popupcontrolid ="Panel1"
              backgroundcssclass="modalBackground"
              dropshadow="True"
              cancelControlId="CancelButton"
              BehaviorId = "mpe" />
              <asp:Panel ID="Panel1" runat="server" style="display:none; width:200px; background-color:White; border-width:2px; border-color:Black; border-style:solid; padding:20px;">
              Are you sure you want Delete Text?
              <br /><br />
              <div style="text-align:right;">
              <asp:Button ID="OkButton" runat="server" Text="OK" />
              <a

              P Offline
              P Offline
              PunkIsNotDead
              wrote on last edited by
              #6

              Ok i understand your problem! I had try your test.aspx and asign the modal pop up dinamically and use it with javascript is a problem... unless you work with datagrid. I personally recommend u to use a gridview and fill it dinamically like the asp table you use... Why i'm recommending this? :confused: is just because the asp table isn't have any event (in the server) that helps you in your problem, with gridview you only add the 'ShowSelectButton = true' and program (in server side) the OnSelectedIndexChanged (of the grid) the modalPopUpExtender.show(); and that's all! i think...

              greetings ;)

              H 1 Reply Last reply
              0
              • P PunkIsNotDead

                Ok i understand your problem! I had try your test.aspx and asign the modal pop up dinamically and use it with javascript is a problem... unless you work with datagrid. I personally recommend u to use a gridview and fill it dinamically like the asp table you use... Why i'm recommending this? :confused: is just because the asp table isn't have any event (in the server) that helps you in your problem, with gridview you only add the 'ShowSelectButton = true' and program (in server side) the OnSelectedIndexChanged (of the grid) the modalPopUpExtender.show(); and that's all! i think...

                greetings ;)

                H Offline
                H Offline
                hi_everybody
                wrote on last edited by
                #7

                Sorry for delay... :( :) thanks for suggestion but its requirement that use asp table instead of gridview..... Your suggestion is useful.... but its requirement.. so can't use gridview... but i can't understand, when i tring to call the javascript through script manager it didn't get behaviour id of modal popup extender....thats why it shows 'null' error :( Plz give me solution on it, as i give test example... plzzzz help me.... thanks and regards, Madhuri.

                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