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. Useing button within Repeater

Useing button within Repeater

Scheduled Pinned Locked Moved ASP.NET
sysadmin
9 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.
  • S Offline
    S Offline
    Shahdat Hosain
    wrote on last edited by
    #1

    I want to use a button within a repeater. To do that I use following code, but After clicking on the button page not response.

    <asp:Repeater ID="repConnections" runat="server" OnItemDataBound="repConnections_ItemDataBound">
    <ItemTemplate>
    <div class="friendBody">
    <Kooras:ProfileDisplaySmall ShowConnectionRequestButton="false" ShowDeleteButton="true" ID="pdProfileDisplay" runat="server" />
    <asp:Button ID="ConnectionDelete" runat="server" Text="Delete" onclick="ConnectionDelete_Click" />
    </div>
    </ItemTemplate>
    </asp:Repeater>

    protected void ConnectionDelete_Click(object sender, EventArgs e)
    { DeleteConnection(Convert.ToInt32(lblConnectionID1.Text));
    }

    Plz verify it.

    shahdat

    C A 2 Replies Last reply
    0
    • S Shahdat Hosain

      I want to use a button within a repeater. To do that I use following code, but After clicking on the button page not response.

      <asp:Repeater ID="repConnections" runat="server" OnItemDataBound="repConnections_ItemDataBound">
      <ItemTemplate>
      <div class="friendBody">
      <Kooras:ProfileDisplaySmall ShowConnectionRequestButton="false" ShowDeleteButton="true" ID="pdProfileDisplay" runat="server" />
      <asp:Button ID="ConnectionDelete" runat="server" Text="Delete" onclick="ConnectionDelete_Click" />
      </div>
      </ItemTemplate>
      </asp:Repeater>

      protected void ConnectionDelete_Click(object sender, EventArgs e)
      { DeleteConnection(Convert.ToInt32(lblConnectionID1.Text));
      }

      Plz verify it.

      shahdat

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Your buttons need to be created BEFORE page load for viewstate to be restored and your events to fire.

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      S 1 Reply Last reply
      0
      • C Christian Graus

        Your buttons need to be created BEFORE page load for viewstate to be restored and your events to fire.

        Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

        S Offline
        S Offline
        Shahdat Hosain
        wrote on last edited by
        #3

        To partial update I use the repeater within a Updatepanel. Is it problem to create a button BEFORE page load? Just now I see that button is work well without using Updatepanel. But I want to partial update the page. Plz help.

        shahdat

        C A 2 Replies Last reply
        0
        • S Shahdat Hosain

          To partial update I use the repeater within a Updatepanel. Is it problem to create a button BEFORE page load? Just now I see that button is work well without using Updatepanel. But I want to partial update the page. Plz help.

          shahdat

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          MD. SHAHDAT HOSAIN wrote:

          Is it problem to create a button BEFORE page load?

          Yes, viewstate is restored early, so your button needs to exist prior to page load, in order for viewstate to be restored.

          Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

          S 1 Reply Last reply
          0
          • S Shahdat Hosain

            To partial update I use the repeater within a Updatepanel. Is it problem to create a button BEFORE page load? Just now I see that button is work well without using Updatepanel. But I want to partial update the page. Plz help.

            shahdat

            A Offline
            A Offline
            Abhijit Jana
            wrote on last edited by
            #5

            Please read this reply. http://www.codeproject.com/Messages/3189316/Re-dynamic-control.aspx[^] Hope this will help you :-D

            Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.

            1 Reply Last reply
            0
            • C Christian Graus

              MD. SHAHDAT HOSAIN wrote:

              Is it problem to create a button BEFORE page load?

              Yes, viewstate is restored early, so your button needs to exist prior to page load, in order for viewstate to be restored.

              Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

              S Offline
              S Offline
              Shahdat Hosain
              wrote on last edited by
              #6

              Thanks Plz hear my real problem. It a big problem to me I have a page Connection.aspx that shows all connections(friends) of a user like faecbook and plaxo.com I need to delete a connection when the user click on delete button() and after deleting he see his new connection list on that page. To do this I use a updatepanel, repeater and usercontrol(profile.ascx). Repeater set in the updatepanel. By repeater all connection show in Connection.aspx using usercontrol(profile.ascx).

              <asp:UpdatePanel ID="UpdatePanel1" runat="server">
              <ContentTemplate>
              <asp:Repeater ID="repConnections" runat="server" OnItemDataBound="repConnections_ItemDataBound">
              <ItemTemplate>
              <div class="friendBody">
              <Kooras:ProfileDisplaySmall ShowConnectionRequestButton="false" ShowDeleteButton="true" ID="pdProfileDisplay" runat="server" />
              </div>
              </ItemTemplate>
              </asp:Repeater>
              </ContentTemplate>
              </asp:UpdatePanel>

              profile.ascx have a delete button to delete connection. When user click on that button, connection actually deleted. but page connection.aspx not be updated. To solve this problem I think following technique I place a button on connection.aspx set visiable false. and after clicking on delete button of the usercontrol(profile.ascx). the button on connection.aspx will be fire. Dear........ If this is right way , Plz tall me how can I Implement it.

              shahdat

              C 1 Reply Last reply
              0
              • S Shahdat Hosain

                Thanks Plz hear my real problem. It a big problem to me I have a page Connection.aspx that shows all connections(friends) of a user like faecbook and plaxo.com I need to delete a connection when the user click on delete button() and after deleting he see his new connection list on that page. To do this I use a updatepanel, repeater and usercontrol(profile.ascx). Repeater set in the updatepanel. By repeater all connection show in Connection.aspx using usercontrol(profile.ascx).

                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                <asp:Repeater ID="repConnections" runat="server" OnItemDataBound="repConnections_ItemDataBound">
                <ItemTemplate>
                <div class="friendBody">
                <Kooras:ProfileDisplaySmall ShowConnectionRequestButton="false" ShowDeleteButton="true" ID="pdProfileDisplay" runat="server" />
                </div>
                </ItemTemplate>
                </asp:Repeater>
                </ContentTemplate>
                </asp:UpdatePanel>

                profile.ascx have a delete button to delete connection. When user click on that button, connection actually deleted. but page connection.aspx not be updated. To solve this problem I think following technique I place a button on connection.aspx set visiable false. and after clicking on delete button of the usercontrol(profile.ascx). the button on connection.aspx will be fire. Dear........ If this is right way , Plz tall me how can I Implement it.

                shahdat

                C Offline
                C Offline
                Christian Graus
                wrote on last edited by
                #7

                MD. SHAHDAT HOSAIN wrote:

                I use a updatepanel, repeater and usercontrol(profile.ascx).

                I think you should use a gridview, which is set up to handle things like delete buttons. I think you should experiment if using AJAX controls is also killing what you're trying to do. I also think you'd have a lot more control if you learned AJAX instead of blindly using the MS library.

                Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                S 1 Reply Last reply
                0
                • C Christian Graus

                  MD. SHAHDAT HOSAIN wrote:

                  I use a updatepanel, repeater and usercontrol(profile.ascx).

                  I think you should use a gridview, which is set up to handle things like delete buttons. I think you should experiment if using AJAX controls is also killing what you're trying to do. I also think you'd have a lot more control if you learned AJAX instead of blindly using the MS library.

                  Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                  S Offline
                  S Offline
                  Shahdat Hosain
                  wrote on last edited by
                  #8

                  Hello Boss I also know about Gridwiew. and the problem can be solve by it. But I want to Implement like plax.com's request connection service. In www.plaxo.com when a user click on request to connect link. A connection connection request send. page automatically updated and when a user click on cross button the deletion also fairly done. Could you Suggest me more?

                  shahdat

                  1 Reply Last reply
                  0
                  • S Shahdat Hosain

                    I want to use a button within a repeater. To do that I use following code, but After clicking on the button page not response.

                    <asp:Repeater ID="repConnections" runat="server" OnItemDataBound="repConnections_ItemDataBound">
                    <ItemTemplate>
                    <div class="friendBody">
                    <Kooras:ProfileDisplaySmall ShowConnectionRequestButton="false" ShowDeleteButton="true" ID="pdProfileDisplay" runat="server" />
                    <asp:Button ID="ConnectionDelete" runat="server" Text="Delete" onclick="ConnectionDelete_Click" />
                    </div>
                    </ItemTemplate>
                    </asp:Repeater>

                    protected void ConnectionDelete_Click(object sender, EventArgs e)
                    { DeleteConnection(Convert.ToInt32(lblConnectionID1.Text));
                    }

                    Plz verify it.

                    shahdat

                    A Offline
                    A Offline
                    Abhishek Sur
                    wrote on last edited by
                    #9

                    Use <asp:Button ID="ConnectionDelete" runat="server" Text="Delete" OnCommand="ConnectionDelete_Click"/> Inside Repeater, the button.click event is not generated. Rather OnCommand will be evaluated. Also you can use CommandArgument if you want any arguments while the event is generated. Inside the eventhandler you can use e.CommandArgument or e.CommandName to handle the command properly. Hope this help u. :thumbsup:

                    Abhishek Sur


                    My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB

                    **Don't forget to click "Good Answer" if you like to.

                    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