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. Add control in UpdatePanel

Add control in UpdatePanel

Scheduled Pinned Locked Moved ASP.NET
question
3 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.
  • M Offline
    M Offline
    mehrdadc48
    wrote on last edited by
    #1

    Hi. I have an UpdatePanel in a UserControl that there is a button on it. By clicking the button I want to add a control (textBox) dynamically to my WebForm. but it doesn't work. If I remove the UpdatePanel that works, but with UpdatePanel Not. What can I do?

    Best wishes

    S M 2 Replies Last reply
    0
    • M mehrdadc48

      Hi. I have an UpdatePanel in a UserControl that there is a button on it. By clicking the button I want to add a control (textBox) dynamically to my WebForm. but it doesn't work. If I remove the UpdatePanel that works, but with UpdatePanel Not. What can I do?

      Best wishes

      S Offline
      S Offline
      sarang_k
      wrote on last edited by
      #2

      in the update panel there is a tag for postback,give the button id in that postback.

      1 Reply Last reply
      0
      • M mehrdadc48

        Hi. I have an UpdatePanel in a UserControl that there is a button on it. By clicking the button I want to add a control (textBox) dynamically to my WebForm. but it doesn't work. If I remove the UpdatePanel that works, but with UpdatePanel Not. What can I do?

        Best wishes

        M Offline
        M Offline
        Mark Graham
        wrote on last edited by
        #3

        So, am I right in saying that your button is doing a postback and your page is reloading(no ajax)? If this is the case then I think it's the Triggers section of the UpdatePanel that you're missing. See my sample code below (you can ignore the content, it's just a report I knocked up). I've made bold and italic the Triggers section I think you could be missing. Also, the code where your dynamic control will be added will have to go in the ContentTemplate section of your UpdatePanel. My apologies if I've missed the point and you're already doing this.

        <asp:Button ID="btnRun\_TopHopFaults" runat="server" Text="Run Report"
            OnClick="btnRun\_TopHopFaults\_Click" />
        <asp:UpdatePanel id="pnlTopHopFaultsResults" runat="server" UpdateMode="Conditional">        
            _**<Triggers>
                <asp:AsyncPostBackTrigger ControlID="btnRun\_TopHopFaults" />
            </Triggers>**_
            <ContentTemplate>                        
                <asp:Repeater ID="repTopHopFaults" runat="server">
                    <HeaderTemplate>
                        <table>
                            <tr>
                                <th></th>
                                <th>Guidance Ref</th>
                                <th>Guidance</th>
                                <th>Quantity</th>
                            </tr>
                    </HeaderTemplate>
                    <ItemTemplate>
                            <tr>
                                <td><%#DataBinder.Eval(Container.DataItem, "Position") %></td>
                                <td><a href='<%#string.Concat("javascript:showHopDrillDown(", DataBinder.Eval(Container.DataItem, "ID"), ")")%>'>
                                    <%#DataBinder.Eval(Container.DataItem, "FieldRef") %>
                                    </a>                                                    
                                </td>
                                <td><%#DataBinder.Eval(Container.DataItem, "Field") %></td>
                                <td><%#DataBinder.Eval(Container.DataItem, "FaultCount") %></td>
                            </tr>                            
                    </ItemTemplate>
                    <FooterTemplate>
                        </table>
                    </FooterTemplate>
                </asp:Repeater>
        
        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