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. How can bind my dropdown inside ajaxPro method?

How can bind my dropdown inside ajaxPro method?

Scheduled Pinned Locked Moved ASP.NET
csharpjavascriptasp-netsysadminquestion
6 Posts 3 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.
  • J Offline
    J Offline
    Jeneesh K Velayudhan
    wrote on last edited by
    #1

    I am using asp.net 2.0 and ajaxPro in my web application. 1. How can bind my dropdown inside ajaxPro method, without using HtmlTextWriter? Is it possible? All the server controls are null inside the ajaxPro method. 2. So, i have created dynamic server controls inside the ajaxPro method and used HtmlTextWriter and rendered in javascript. Here in javascript, i can't able to get this dynamic controls by using getElementId method. document.getElementId(asp.net control id + "ControlId"); but it returns null. thanx in advance! :)

    Thanks & Regards, Jeneesh K. Velayudhan

    N D 2 Replies Last reply
    0
    • J Jeneesh K Velayudhan

      I am using asp.net 2.0 and ajaxPro in my web application. 1. How can bind my dropdown inside ajaxPro method, without using HtmlTextWriter? Is it possible? All the server controls are null inside the ajaxPro method. 2. So, i have created dynamic server controls inside the ajaxPro method and used HtmlTextWriter and rendered in javascript. Here in javascript, i can't able to get this dynamic controls by using getElementId method. document.getElementId(asp.net control id + "ControlId"); but it returns null. thanx in advance! :)

      Thanks & Regards, Jeneesh K. Velayudhan

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      jeneesh k. wrote:

      How can bind my dropdown inside ajaxPro method

      You can't, databinding is done during page rendering by the ASP.NET engine.

      jeneesh k. wrote:

      All the server controls are null inside the ajaxPro method.

      Of course they are. You need to understand the page lifecycle and ajax calls. Basically, you seem to have no clue about what Ajax is and how to use it. Please do us all, including yourself, a favor and research and understand the technology before trying to use it.


      I know the language. I've read a book. - _Madmatt

      J 1 Reply Last reply
      0
      • J Jeneesh K Velayudhan

        I am using asp.net 2.0 and ajaxPro in my web application. 1. How can bind my dropdown inside ajaxPro method, without using HtmlTextWriter? Is it possible? All the server controls are null inside the ajaxPro method. 2. So, i have created dynamic server controls inside the ajaxPro method and used HtmlTextWriter and rendered in javascript. Here in javascript, i can't able to get this dynamic controls by using getElementId method. document.getElementId(asp.net control id + "ControlId"); but it returns null. thanx in advance! :)

        Thanks & Regards, Jeneesh K. Velayudhan

        D Offline
        D Offline
        daveyerwin
        wrote on last edited by
        #3

        I would recommend moving to ASP.NET AJAX which is built into Visual Studio 2008 and available as additional feature pack for Visual Studio .NET 2005. It provdes an update panel which can bind your controls during an ajax call, here is a simple example ...

        <%@ Page Language="C#" %>

        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
        Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

        <script runat="server">
        protected void Button1_Click(object sender, EventArgs e)
        {
        DropDownList1.Items.Clear();
        String[] ds = {"hi","sup"};
        DropDownList1.DataSource = ds;
        DropDownList1.DataBind();
        }

        </script>

        <html xmlns="http://www.w3.org/1999/xhtml" >
        <head id="Head1" runat="server">
        <title>Untitled Page</title>
        <style type="text/css">
        #UpdatePanel1 {
        width:300px; height:100px;
        }
        </style>
        </head>
        <body>
        <form id="form1" runat="server">
        <div style="padding-top: 10px">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
        <fieldset>
        <legend>UpdatePanel</legend>
        <asp:DropDownList ID="DropDownList1" runat="server">
        </asp:DropDownList>
        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
        </fieldset>
        </ContentTemplate>
        </asp:UpdatePanel>
        <br />
        </div>

        </div>
        </form>
        

        </body>
        </html>

        J 1 Reply Last reply
        0
        • D daveyerwin

          I would recommend moving to ASP.NET AJAX which is built into Visual Studio 2008 and available as additional feature pack for Visual Studio .NET 2005. It provdes an update panel which can bind your controls during an ajax call, here is a simple example ...

          <%@ Page Language="C#" %>

          <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
          Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

          <script runat="server">
          protected void Button1_Click(object sender, EventArgs e)
          {
          DropDownList1.Items.Clear();
          String[] ds = {"hi","sup"};
          DropDownList1.DataSource = ds;
          DropDownList1.DataBind();
          }

          </script>

          <html xmlns="http://www.w3.org/1999/xhtml" >
          <head id="Head1" runat="server">
          <title>Untitled Page</title>
          <style type="text/css">
          #UpdatePanel1 {
          width:300px; height:100px;
          }
          </style>
          </head>
          <body>
          <form id="form1" runat="server">
          <div style="padding-top: 10px">
          <asp:ScriptManager ID="ScriptManager1" runat="server">
          </asp:ScriptManager>
          <asp:UpdatePanel ID="UpdatePanel1" runat="server">
          <ContentTemplate>
          <fieldset>
          <legend>UpdatePanel</legend>
          <asp:DropDownList ID="DropDownList1" runat="server">
          </asp:DropDownList>
          <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
          </fieldset>
          </ContentTemplate>
          </asp:UpdatePanel>
          <br />
          </div>

          </div>
          </form>
          

          </body>
          </html>

          J Offline
          J Offline
          Jeneesh K Velayudhan
          wrote on last edited by
          #4

          Hi, i know update panel. I have to make server calls from client side by taking the value from first combo need to populate the second one. dont use selected change event. How it is possible????

          Thanks & Regards, Jeneesh K. Velayudhan

          D 1 Reply Last reply
          0
          • N Not Active

            jeneesh k. wrote:

            How can bind my dropdown inside ajaxPro method

            You can't, databinding is done during page rendering by the ASP.NET engine.

            jeneesh k. wrote:

            All the server controls are null inside the ajaxPro method.

            Of course they are. You need to understand the page lifecycle and ajax calls. Basically, you seem to have no clue about what Ajax is and how to use it. Please do us all, including yourself, a favor and research and understand the technology before trying to use it.


            I know the language. I've read a book. - _Madmatt

            J Offline
            J Offline
            Jeneesh K Velayudhan
            wrote on last edited by
            #5

            Hi, I have to make server calls from client side by taking the value from first combo need to populate the second one. dont use selected change event. How it is possible????

            Thanks & Regards, Jeneesh K. Velayudhan

            1 Reply Last reply
            0
            • J Jeneesh K Velayudhan

              Hi, i know update panel. I have to make server calls from client side by taking the value from first combo need to populate the second one. dont use selected change event. How it is possible????

              Thanks & Regards, Jeneesh K. Velayudhan

              D Offline
              D Offline
              daveyerwin
              wrote on last edited by
              #6

              <%@ Page Language="C#" %>
              <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
              Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
              <script runat="server">
              protected void Button1_Click(object sender, EventArgs e)
              {
              DropDownList1.Items.Clear();
              String[] ds = {"hi RED","sup RED"};
              String[] ds1 = { "hi BLUE", "sup BLUE" };
              if (DropDownList2.SelectedValue == "RED")
              {
              DropDownList1.DataSource = ds;
              DropDownList1.DataBind();
              }
              if (DropDownList2.SelectedValue == "BLUE")
              {
              DropDownList1.DataSource = ds1;
              DropDownList1.DataBind();
              }
              }
              </script>
              <html xmlns="http://www.w3.org/1999/xhtml" >
              <head id="Head1" runat="server">
              <title>Untitled Page</title>
              <style type="text/css">
              #UpdatePanel1 { width:300px; height:100px; } </style>
              </head>
              <body>
              <form id="form1" runat="server">
              <div style="padding-top: 10px">
              <asp:ScriptManager ID="ScriptManager1" runat="server">
              </asp:ScriptManager>
              <asp:UpdatePanel ID="UpdatePanel1" runat="server">
              <ContentTemplate>
              <fieldset>
              <legend>UpdatePanel</legend>
              <asp:DropDownList ID="DropDownList1" runat="server">
              </asp:DropDownList>
              <asp:DropDownList ID="DropDownList2" runat="server">
              asp:ListItemRED</asp:ListItem>
              asp:ListItemBLUE</asp:ListItem>
              </asp:DropDownList>
              <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
              </fieldset>
              </ContentTemplate>
              </asp:UpdatePanel>
              <br />
              </div>
              </div>
              </form>
              </body>
              </html>

              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