CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2006
    Posts
    15

    Exclamation GridView button with condition

    I have a gridview with 3 columns Name,Surname,Change(ButtonField column) which is populated from an SqlDataReader with the following code

    SqlCommand sqlCommand = new SqlCommand("select * from Empl where userId ='" + userid + "'", sqlConnection);
    sqlConnection.Open();

    SqlDataReader reader = sqlCommand.ExecuteReader();

    GridView1.DataSource = reader;
    GridView1.DataBind();

    In my database there are 4 columns UserId,Name,Surname,Change(bit). How can i show the button change only when Change(bit) column is true inside the database?

  2. #2
    Join Date
    May 2011
    Location
    Washington State
    Posts
    220

    Re: GridView button with condition

    Hi pikkas...

    I have never done it... but I did find an msdn article describing a way to do this if that helps...

    http://msdn.microsoft.com/en-us/library/ms171619.aspx
    Last edited by fcronin; August 19th, 2011 at 10:38 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured