title: adding a gridview's values in a label with asp.net C#
body: <p>I have a gridview and a button.When I click the button a sentence is written in my form. I want call the datas entered in the gridview and see them in the label.
  Here is my code but it does not work:</p>
  <pre><code>//code of gridview:
   &lt;asp:GridView ID=&quot;GridView1&quot; runat=&quot;server&quot; AutoGenerateColumns=&quot;False&quot; 
              BackColor=&quot;White&quot; BorderColor=&quot;#3366CC&quot; BorderStyle=&quot;None&quot; BorderWidth=&quot;1px&quot; 
              CellPadding=&quot;4&quot; DataKeyNames=&quot;ProductID&quot; DataSourceID=&quot;SqlDataSource2&quot; 
              CssClass=&quot;grid&quot;&gt;
              &lt;Columns&gt;
                  &lt;asp:ImageField DataImageUrlField=&quot;ImageUrl&quot; HeaderText=&quot;image&quot;&gt;
                      &lt;ControlStyle Height=&quot;130px&quot; Width=&quot;130px&quot; /&gt;
                  &lt;/asp:ImageField&gt;
                  &lt;asp:BoundField DataField=&quot;Description&quot; HeaderText=&quot;department&quot; 
                      SortExpression=&quot;Description&quot; /&gt;
                  &lt;asp:BoundField DataField=&quot;ProductName&quot; HeaderText=&quot;name&quot; 
                      SortExpression=&quot;ProductName&quot; /&gt;
                  &lt;asp:BoundField DataField=&quot;ProductID&quot; HeaderText=&quot;code&quot; 
                      SortExpression=&quot;ProductID&quot; ReadOnly=&quot;True&quot; /&gt;
              &lt;/Columns&gt;
              &lt;FooterStyle BackColor=&quot;#99CCCC&quot; ForeColor=&quot;#003399&quot; /&gt;
              &lt;HeaderStyle BackColor=&quot;#003399&quot; Font-Bold=&quot;True&quot; ForeColor=&quot;#CCCCFF&quot; /&gt;
              &lt;PagerStyle BackColor=&quot;#99CCCC&quot; ForeColor=&quot;#003399&quot; HorizontalAlign=&quot;Left&quot; /&gt;
              &lt;RowStyle BackColor=&quot;White&quot; ForeColor=&quot;#003399&quot; /&gt;
              &lt;SelectedRowStyle BackColor=&quot;#009999&quot; Font-Bold=&quot;True&quot; ForeColor=&quot;#CCFF99&quot; /&gt;
              &lt;SortedAscendingCellStyle BackColor=&quot;#EDF6F6&quot; /&gt;
              &lt;SortedAscendingHeaderStyle BackColor=&quot;#0D4AC4&quot; /&gt;
              &lt;SortedDescendingCellStyle BackColor=&quot;#D6DFDF&quot; /&gt;
              &lt;SortedDescendingHeaderStyle BackColor=&quot;#002876&quot; /&gt;
          &lt;/asp:GridView&gt;
  //the code of button
  protected void Button1_Click(object sender, EventArgs e)
      {
               if (RadioButton2.Checked)
                  txtid.Text = &quot;name&quot;+ProductName+&quot;department&quot;+description+&quot;code&quot;+productID;
         
      }
  </code></pre>