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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Link Button in a DataList

Link Button in a DataList

Scheduled Pinned Locked Moved ASP.NET
databasedesign
1 Posts 1 Posters 1 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.
  • A Offline
    A Offline
    asifmaniar
    wrote on last edited by
    #1

    Hi I have a list of items in a datalist and for each item i have a linkbutton. When user clicks the link button I am enabling/disabling the item in the database and reloading the datalist to reflect the new status. I am using the Item_Command event to check if the linkbutton was clicked. However i noticed that the command fires even when the page is just reloaded and thus it reverses the status of the last item that is clicked. The code looks like this - Private Sub dlActivity_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles dlActivity.ItemCommand Dim rows As DataSet rows = CType(Me.dlActivity.DataSource, DataSet) If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then Dim colID As String colID = CType(rows.Tables(0).Rows(e.Item.ItemIndex).Item("ActivityID"), String) 'this line changes the item status t5Activity.ChangeStatus(colID) 'this line calls the method to reload the datalist GetList() End If End Sub Can I handle this in such a way that the ststus is updated only when someone actually clicks on the link button and not when the page is refreshed.

    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