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
C

CSharpJunkie

@CSharpJunkie
About
Posts
1
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • ItemCommand Not Firing with ImageButton
    C CSharpJunkie

    OK I was just about to post a question on here, and I went to check one more thing before posting it. I got it to work. BUT, I still want to know why it didnt work the other way. I have a DataList for a menu. I have plus and minus gifs that expand and collapse when clicked. When these gifs were rendered using ImageButton, they would not fire the ItemCommand event for the DataGrid. I then Changed them to LinkButtons, with a basic image tag for the text, and the event fires....WHY? Here is the code for the scenario that did NOT work. (Using the ImageButton) '********************************************************* '***************** THIS CHANGED************************ '****************************************************** .....HTML Table removed Here...... to keep it simple, this was just the department names, and category names with category names indented to show they resided under Departments ***** The code Behind for the ItemCommand Event That did NOT work Looked like this.... Public Sub DataGrid1_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.ItemCommand '*********************THIS CHANGED *********************** If CType(e.Item.Cells(0).FindControl("img"), ImageButton).ImageUrl.EndsWith("closed.gif") Then '******************************************************* ' condition for node opening Dim i As Integer = 1 Dim Root As System.Int64 = Convert.ToInt64(DataGrid1.Items(e.Item.ItemIndex).Cells(1).Text()) Dim img As ImageButton For i = 1 To DataGrid1.Items.Count - 1 If (CInt(DataGrid1.Items(i).Cells(1).Text) = Root) Then 'This is a department DataGrid1.Items(i).Visible = True End If If CType(DataGrid1.Items(i).Cells(2).Text, Integer) > 0 Then DataGrid1.Items(i).Cells(0).Controls.Clear() DataGri

    ASP.NET question html design
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups