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. General Programming
  3. C#
  4. GridView in C#. Only alternate colum gets binded in DataControlRowState

GridView in C#. Only alternate colum gets binded in DataControlRowState

Scheduled Pinned Locked Moved C#
csharpdatabasewpfwcf
3 Posts 2 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.
  • B Offline
    B Offline
    Bino B
    wrote on last edited by
    #1

    In RowDataBound event of GridView the DataControlRowState.Edit will trigger only alternatively. If we are binding the column with a RadioButtonList,only alternate columns will only get binded.Is there any solution for this.

    Regards Bino http://www.technix.co.nr

    V 1 Reply Last reply
    0
    • B Bino B

      In RowDataBound event of GridView the DataControlRowState.Edit will trigger only alternatively. If we are binding the column with a RadioButtonList,only alternate columns will only get binded.Is there any solution for this.

      Regards Bino http://www.technix.co.nr

      V Offline
      V Offline
      Virendrak
      wrote on last edited by
      #2

      private void dgContacts_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) { DataGridItem item = e.Item; if (item.ItemType == ListItemType.AlternatingItem || item.ItemType == ListItemType.Item) { if ((e.Item.ItemIndex % 2) != 0) { LinkButton editButton = item.Cells[0].Controls[0] as LinkButton; if (editButton != null && editButton.CommandName == "Edit") { editButton.Visible = false; } } } }

      Never Think That You Have Failed Instead Always Think That u hav Better Chance Next Time...

      B 1 Reply Last reply
      0
      • V Virendrak

        private void dgContacts_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) { DataGridItem item = e.Item; if (item.ItemType == ListItemType.AlternatingItem || item.ItemType == ListItemType.Item) { if ((e.Item.ItemIndex % 2) != 0) { LinkButton editButton = item.Cells[0].Controls[0] as LinkButton; if (editButton != null && editButton.CommandName == "Edit") { editButton.Visible = false; } } } }

        Never Think That You Have Failed Instead Always Think That u hav Better Chance Next Time...

        B Offline
        B Offline
        Bino B
        wrote on last edited by
        #3

        we need to check both conditions (e.Row.Rowstate & DataControlRowSatate)>0 now it will work fine www.codepal.co.nr

        Regards Bino http://www.codepal.co.nr

        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