Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7081625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:56:39+00:00 2026-05-28T06:56:39+00:00

This my data list: <asp:DataList ID=DataList1 runat=server DataSourceID=SqlDataSource1 RepeatLayout=Flow> <ItemTemplate> Titre: <asp:Label ID=TitreLabel runat=server

  • 0

This my data list:

     <asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource1" 
               RepeatLayout="Flow">
            <ItemTemplate>
                Titre:
                <asp:Label ID="TitreLabel" runat="server" Text='<%# Eval("Titre") %>' />
                <br />
                Description:
                <asp:Label ID="DescriptionLabel" runat="server" 
                    Text='<%# Eval("Description") %>' />
                <br />

                <asp:Image ID="Image1" runat="server" 
                 ImageUrl='<%# Eval("ID", "Handler.ashx?ID={0}") %>' Width="200" Height="200"/>

                <br />
                comments:
                <asp:Label ID="commentsLabel" runat="server" Text='<%# Eval("comments") %>' />
                <br />

                Ajouter commentaire 
                <asp:button ID="btnAjouter"  runat="server" Text="Ajouter" />
                <br/>
                <br/>
            </ItemTemplate>
        </asp:DataList>

In the Vb.aspx code I create a method:

public Sub updateComments()
.......
End Sub

And I want to add an event to my DataList button and excute the method.

I don’t know how to do it correctly.

This is in Vb.net.

Thanks

Frank

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:56:40+00:00Added an answer on May 28, 2026 at 6:56 am

    You just need to add a CommandName to your button and handle the DataList’s ItemCommand.

    For example(in ItemTemplate)

    <asp:button ID="btnAjouter" CommandName="Ajouter"  runat="server" Text="Ajouter" />
    

    In Codebehind:

    Sub Item_Command(sender As Object, e As DataListCommandEventArgs)Handles DataList1.ItemCommand
        If e.CommandName = "Ajouter"
            '  do something '
        End If
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my datalist: <asp:DataList ID=DataList1 runat=server DataSourceID=SqlDataSource1 RepeatLayout=Flow> <ItemTemplate> <asp:Label ID=IdLabel runat=server Text='<%#
I have a datalist like this: <asp:DataList ID=dl runat=server Width=301px onitemcommand=dl_ItemCommand> <ItemTemplate> <table style=border:solid
Here is my DataList: <asp:DataList id=DataList Visible=false RepeatDirection=Horizontal Width=100% HorizontalAlign=Justify RepeatLayout=Flow runat=server> [Contents Removed]
I have a DataList like below: <asp:DataList runat=server ID=myDataList> <ItemTemplate> <uc:MyControl ID=id1 runat=server PublicProperty='<%#
i have a datalist in my aspx like this: <asp:DataList ID=dlSubs runat=server CellPadding=0 CellSpacing=5
I have the following itemTemplate in my datalist <ItemTemplate> <asp:LinkButton ID=LinkButton1 CommandName=Select autopostback=True runat=server>'<%#
I have a DataList like so: <asp:DataList ID=dlMyList runat=server RepeatColumns=5 RepeatDirection=Horizontal CellSpacing=5 > <ItemTemplate>
This is my bare DataList definition :- <asp:DataList runat=server ID=dtltrial ondeletecommand=dtltrial_DeleteCommand DataKeyField=PhotoId > </asp:DataList>
I have a simple usercontrol, with a datalist, and checkboxes inside. <asp:DataList ID=DataListDroits runat=server
I have a strange issue in a datalist <asp:DataList ID=dl RepeatColumns=8 runat=server GridLines=None OnItemDataBound=dl_idb

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.