2 Replies - 191 Views - Last Post: 14 May 2014 - 07:26 AM

#1 articuno  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 04-May 12

Gridview and checkbox problem

Posted 13 May 2014 - 02:44 AM

Hi, i have .aspx and aspx.cs file. In .aspx i have asp:GridView. In aspx.cs file, i have a method getCheckedProduct, where i get checked values

        private void getCheckedProduct()
        {
            if (selected == string.Empty)
            {
                selected = Request.Form["selectProductName"];
            }
            else if (selected != string.Empty && Request.Form["selectProductName"] != string.Empty)
            {
                selected = selected + "," + Request.Form["selectProductName"];
            }
        }



When i change the GridView page from 1 to 2 and back from 2 to 1, if statement ("&& Request.Form["selectProductName"] != string.Empty)") in getCheckedProduct() method does not detect tis... in the variable "selected" is added ",". Why?

Is This A Good Question/Topic? 0
  • +

Replies To: Gridview and checkbox problem

#2 depricated  Icon User is online

  • DLN-000

Reputation: 586
  • View blog
  • Posts: 2,093
  • Joined: 13-September 08

Re: Gridview and checkbox problem

Posted 14 May 2014 - 07:15 AM

Is it just "," or is it something like " , "?
Was This Post Helpful? 0
  • +
  • -

#3 depricated  Icon User is online

  • DLN-000

Reputation: 586
  • View blog
  • Posts: 2,093
  • Joined: 13-September 08

Re: Gridview and checkbox problem

Posted 14 May 2014 - 07:26 AM

also, selected - from this context - appears to be at least a class level variable. Is it possible that it's set to something that's causing it to skip the first if clause and move to the second?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1