Rowshan Ali

Rowshan Ali

  • 1.9k
  • 64
  • 121.1k

Export to excel gridview based on specific column.?

May 27 2013 11:00 PM
hello dear 
i m in problems. 
i need to export gridview to excel based on specidic column such as WONo, Description, QtyWo. how can i do it ? if any body help me best regurds.

  1. <
    table class="style1">  
  2.      <tbody>  
  3.          <tr>  
  4.              <td colspan="4">  
  5.              <div id="ContentPlaceHolder1_divbix">  
  6.              <div>  
  7.              <table id="ContentPlaceHolder1_GridView1" border="1" rules="all" cellspacing="0" style="width: 900px; border-collapse: collapse;">  
  8.                  <tbody>  
  9.                      <tr style="background-color: #9933ff; color: aqua;">  
  10.                          <th scope="col">VIEW</th> <th scope="col">Update</th> <th scope="col">WOId</th> <th scope="col">WONo</th> <th scope="col">PRNo</th> <th scope="col">Description</th> <th scope="col">QtyWo</th> <th scope="col">Date</th> <th scope="col">Price</th> <th scope="col">Approval</th> <th scope="col">WOSL</th> <th scope="col">Usersn</th>  
  11.                      </tr>  
  12.                      <tr>  
  13.                          <td><span style="background-color: activecaption; color: aqua; font-weight: bold;"><input id="ContentPlaceHolder1_GridView1_ChbView_0" type="checkbox" name="ctl00$ContentPlaceHolder1$GridView1$ctl02$ChbView" /><label for="ContentPlaceHolder1_GridView1_ChbView_0">13</label></span> </td>  
  14.                          <td><span style="background-color: red; color: aqua; font-weight: bold;"><input id="ContentPlaceHolder1_GridView1_ChbUpdate_0" type="checkbox" name="ctl00$ContentPlaceHolder1$GridView1$ctl02$ChbUpdate" /><label for="ContentPlaceHolder1_GridView1_ChbUpdate_0">13</label></span> </td>  
  15.                          <td title="13">13</td>  
  16.                          <td title="WO-1">WO-1</td>  
  17.                          <td title="PR-1">PR-1</td>  
  18.                          <td title="FB LABEL_NANO TAG">FB LABEL_NANO TAG</td>  
  19.                          <td title="15000">15000</td>  
  20.                          <td title="5/15/2013">5/15/2013</td>  
  21.                          <td title="20.0000">20.0000</td>  
  22.                          <td title="True">True</td>  
  23.                          <td title="52">52</td>  
  24.                          <td title=" "> </td>  
  25.                      </tr>  
  26.                      <tr>  
  27.                          <td><span style="background-color: activecaption; color: aqua; font-weight: bold;"><input id="ContentPlaceHolder1_GridView1_ChbView_1" type="checkbox" name="ctl00$ContentPlaceHolder1$GridView1$ctl03$ChbView" /><label for="ContentPlaceHolder1_GridView1_ChbView_1">13</label></span> </td>  
  28.                          <td><span style="background-color: red; color: aqua; font-weight: bold;"><input id="ContentPlaceHolder1_GridView1_ChbUpdate_1" type="checkbox" name="ctl00$ContentPlaceHolder1$GridView1$ctl03$ChbUpdate" /><label for="ContentPlaceHolder1_GridView1_ChbUpdate_1">13</label></span> </td>  
  29.                          <td title="13">13</td>  
  30.                          <td title="WO-1">WO-1</td>  
  31.                          <td title="PR-1">PR-1</td>  
  32.                          <td title="Master carton 52*80_NANO TAG">Master carton 52*80_....</td>  
  33.                          <td title="5000">5000</td>  
  34.                          <td title="5/15/2013">5/15/2013</td>  
  35.                          <td title="20.0000">20.0000</td>  
  36.                          <td title="True">True</td>  
  37.                          <td title="53">53</td>  
  38.                          <td title=" "> </td>  
  39.                      </tr>  
  40.                      <tr>  
  41.                          <td><span style="background-color: activecaption; color: aqua; font-weight: bold;"><input id="ContentPlaceHolder1_GridView1_ChbView_2" type="checkbox" name="ctl00$ContentPlaceHolder1$GridView1$ctl04$ChbView" /><label for="ContentPlaceHolder1_GridView1_ChbView_2">14</label></span> </td>  
  42.                          <td><span style="background-color: red; color: aqua; font-weight: bold;"><input id="ContentPlaceHolder1_GridView1_ChbUpdate_2" type="checkbox" name="ctl00$ContentPlaceHolder1$GridView1$ctl04$ChbUpdate" /><label for="ContentPlaceHolder1_GridView1_ChbUpdate_2">14</label></span> </td>  
  43.                          <td title="14">14</td>  
  44.                          <td title="Wo-ch">Wo-ch</td>  
  45.                          <td title="PR-ch">PR-ch</td>  
  46.                          <td title="Gray color_Gray color">Gray color_Gray colo....</td>  
  47.                          <td title="500">500</td>  
  48.                          <td title="5/19/2013">5/19/2013</td>  
  49.                          <td title="20.0000">20.0000</td>  
  50.                          <td title="True">True</td>  
  51.                          <td title="54">54</td>  
  52.                          <td title="rowshan">rowshan</td>  
  53.                      </tr>  
  54.                      <tr>  
  55.                          <td><span style="background-color: activecaption; color: aqua; font-weight: bold;"><input id="ContentPlaceHolder1_GridView1_ChbView_3" type="checkbox" name="ctl00$ContentPlaceHolder1$GridView1$ctl05$ChbView" /><label for="ContentPlaceHolder1_GridView1_ChbView_3">15</label></span> </td>  
  56.                          <td><span style="background-color: red; color: aqua; font-weight: bold;"><input id="ContentPlaceHolder1_GridView1_ChbUpdate_3" type="checkbox" name="ctl00$ContentPlaceHolder1$GridView1$ctl05$ChbUpdate" /><label for="ContentPlaceHolder1_GridView1_ChbUpdate_3">15</label></span> </td>  
  57.                          <td title="15">15</td>  
  58.                          <td title="PRE1888-WO-1">PRE1888-WO-1</td>  
  59.                          <td title="PRE1888-PR-01">PRE1888-PR-01</td>  
  60.                          <td title="MASTER CARTON UNPRINTED - 50X27 30.5_">MASTER CARTON UNPRIN....</td>  
  61.                          <td title="5000">5000</td>  
  62.                          <td title="5/11/2013">5/11/2013</td>  
  63.                          <td title="100.0000">100.0000</td>  
  64.                          <td title="False">False</td>  
  65.                          <td title="55">55</td>  
  66.                          <td title="rowshan">rowshan</td>  
  67.                      </tr>  
  68.                      <tr>  
  69.                          <td><span style="background-color: activecaption; color: aqua; font-weight: bold;"><input id="ContentPlaceHolder1_GridView1_ChbView_4" type="checkbox" name="ctl00$ContentPlaceHolder1$GridView1$ctl06$ChbView" /><label for="ContentPlaceHolder1_GridView1_ChbView_4">15</label></span> </td>  
  70.                          <td><span style="background-color: red; color: aqua; font-weight: bold;"><input id="ContentPlaceHolder1_GridView1_ChbUpdate_4" type="checkbox" name="ctl00$ContentPlaceHolder1$GridView1$ctl06$ChbUpdate" /><label for="ContentPlaceHolder1_GridView1_ChbUpdate_4">15</label></span> </td>  
  71.                          <td title="15">15</td>  
  72.                          <td title="PRE1888-WO-1">PRE1888-WO-1</td>  
  73.                          <td title="PRE1888-PR-01">PRE1888-PR-01</td>  
  74.                          <td title="MASTER CARTON UNPRINTED - 58X37 22.5_">MASTER CARTON UNPRIN....</td>  
  75.                          <td title="4000">4000</td>  
  76.                          <td title="5/11/2013">5/11/2013</td>  
  77.                          <td title="200.0000">200.0000</td>  
  78.                          <td title="False">False</td>  
  79.                          <td title="56">56</td>  
  80.                          <td title="rowshan">rowshan</td>  
  81.                      </tr>  
  82.                      <tr>  
  83.                          <td><span style="background-color: activecaption; color: aqua; font-weight: bold;"><input id="ContentPlaceHolder1_GridView1_ChbView_5" type="checkbox" name="ctl00$ContentPlaceHolder1$GridView1$ctl07$ChbView" /><label for="ContentPlaceHolder1_GridView1_ChbView_5">18</label></span> </td>  
  84.                          <td><span style="background-color: red; color: aqua; font-weight: bold;"><input id="ContentPlaceHolder1_GridView1_ChbUpdate_5" type="checkbox" name="ctl00$ContentPlaceHolder1$GridView1$ctl07$ChbUpdate" /><label for="ContentPlaceHolder1_GridView1_ChbUpdate_5">18</label></span> </td>  
  85.                          <td title="18">18</td>  
  86.                          <td title="WO-Yea">WO-Yea</td>  
  87.                          <td title="PR-Y">PR-Y</td>  
  88.                          <td title="10% cotton_">10% cotton_</td>  
  89.                          <td title="200">200</td>  
  90.                          <td title="5/27/2013">5/27/2013</td>  
  91.                          <td title="10.0000">10.0000</td>  
  92.                          <td title="False">False</td>  
  93.                          <td title="57">57</td>  
  94.                          <td title="rowshan">rowshan</td>  
  95.                      </tr>  
  96.                      <tr>  
  97.                          <td><span style="background-color: activecaption; color: aqua; font-weight: bold;"><input id="ContentPlaceHolder1_GridView1_ChbView_6" type="checkbox" name="ctl00$ContentPlaceHolder1$GridView1$ctl08$ChbView" /><label for="ContentPlaceHolder1_GridView1_ChbView_6">18</label></span> </td>  
  98.                          <td><span style="background-color: red; color: aqua; font-weight: bold;"><input id="ContentPlaceHolder1_GridView1_ChbUpdate_6" type="checkbox" name="ctl00$ContentPlaceHolder1$GridView1$ctl08$ChbUpdate" /><label for="ContentPlaceHolder1_GridView1_ChbUpdate_6">18</label></span> </td>  
  99.                          <td title="18">18</td>  
  100.                          <td title="WO-Yea">WO-Yea</td>  
  101.                          <td title="PR-Y">PR-Y</td>  
  102.                          <td title="10% cotton_100% cotton">10% cotton_100% cott....</td>  
  103.                          <td title="1000">1000</td>  
  104.                          <td title="5/27/2013">5/27/2013</td>  
  105.                          <td title="10.0000">10.0000</td>  
  106.                          <td title="False">False</td>  
  107.                          <td title="58">58</td>  
  108.                          <td title="rowshan">rowshan</td>  
  109.                      </tr>  
  110.                      <tr>  
  111.                          <td><span style="background-color: activecaption; color: aqua; font-weight: bold;"><input id="ContentPlaceHolder1_GridView1_ChbView_7" type="checkbox" name="ctl00$ContentPlaceHolder1$GridView1$ctl09$ChbView" /><label for="ContentPlaceHolder1_GridView1_ChbView_7">19</label></span> </td>  
  112.                          <td><span style="background-color: red; color: aqua; font-weight: bold;"><input id="ContentPlaceHolder1_GridView1_ChbUpdate_7" type="checkbox" name="ctl00$ContentPlaceHolder1$GridView1$ctl09$ChbUpdate" /><label for="ContentPlaceHolder1_GridView1_ChbUpdate_7">19</label></span> </td>  
  113.                          <td title="19">19</td>  
  114.                          <td title="PRE1888-WO-02">PRE1888-WO-02</td>  
  115.                          <td title="PRE1888-PR-02">PRE1888-PR-02</td>  
  116.                          <td title="FB LABEL_HAND TAG">FB LABEL_HAND TAG</td>  
  117.                          <td title="16500">16500</td>  
  118.                          <td title="5/26/2013">5/26/2013</td>  
  119.                          <td title="12500.0000">12500.0000</td>  
  120.                          <td title="False">False</td>  
  121.                          <td title="59">59</td>  
  122.                          <td title=" "> </td>  
  123.                      </tr>  
  124.                      <tr>  
  125.                          <td><span style="background-color: activecaption; color: aqua; font-weight: bold;"><input id="ContentPlaceHolder1_GridView1_ChbView_8" type="checkbox" name="ctl00$ContentPlaceHolder1$GridView1$ctl10$ChbView" /><label for="ContentPlaceHolder1_GridView1_ChbView_8">19</label></span> </td>  
  126.                          <td><span style="background-color: red; color: aqua; font-weight: bold;"><input id="ContentPlaceHolder1_GridView1_ChbUpdate_8" type="checkbox" name="ctl00$ContentPlaceHolder1$GridView1$ctl10$ChbUpdate" /><label for="ContentPlaceHolder1_GridView1_ChbUpdate_8">19</label></span> </td>  
  127.                          <td title="19">19</td>  
  128.                          <td title="PRE1888-WO-02">PRE1888-WO-02</td>  
  129.                          <td title="PRE1888-PR-02">PRE1888-PR-02</td>  
  130.                          <td title="WK-STRICKER_NANO TAG">WK-STRICKER_NANO TAG</td>  
  131.                          <td title="10000">10000</td>  
  132.                          <td title="5/26/2013">5/26/2013</td>  
  133.                          <td title="1222.0000">1222.0000</td>  
  134.                          <td title="False">False</td>  
  135.                          <td title="60">60</td>  
  136.                          <td title=" "> </td>  
  137.                      </tr>  
  138.                      <tr>  
  139.                          <td><span style="background-color: activecaption; color: aqua; font-weight: bold;"><input id="ContentPlaceHolder1_GridView1_ChbView_9" type="checkbox" name="ctl00$ContentPlaceHolder1$GridView1$ctl11$ChbView" /><label for="ContentPlaceHolder1_GridView1_ChbView_9">18</label></span> </td>  
  140.                          <td><span style="background-color: red; color: aqua; font-weight: bold;"><input id="ContentPlaceHolder1_GridView1_ChbUpdate_9" type="checkbox" name="ctl00$ContentPlaceHolder1$GridView1$ctl11$ChbUpdate" /><label for="ContentPlaceHolder1_GridView1_ChbUpdate_9">18</label></span> </td>  
  141.                          <td title="18">18</td>  
  142.                          <td title="WO-Yea">WO-Yea</td>  
  143.                          <td title="PR-Y">PR-Y</td>  
  144.                          <td title="10% cotton_">10% cotton_</td>  
  145.                          <td title="300">300</td>  
  146.                          <td title="5/27/2013">5/27/2013</td>  
  147.                          <td title="20.0000">20.0000</td>  
  148.                          <td title="False">False</td>  
  149.                          <td title="61">61</td>  
  150.                          <td title=" "> </td>  
  151.                      </tr>  
  152.                      <tr>  
  153.                          <td><span style="background-color: activecaption; color: aqua; font-weight: bold;"><input id="ContentPlaceHolder1_GridView1_ChbView_10" type="checkbox" name="ctl00$ContentPlaceHolder1$GridView1$ctl12$ChbView" /></span> </td>  
  154.                          <td><span style="background-color: red; color: aqua; font-weight: bold;"><input id="ContentPlaceHolder1_GridView1_ChbUpdate_10" type="checkbox" name="ctl00$ContentPlaceHolder1$GridView1$ctl12$ChbUpdate" /></span> </td>  
  155.                          <td title=" "> </td>  
  156.                          <td title=" "> </td>  
  157.                          <td title=" "> </td>  
  158.                          <td title=" "> </td>  
  159.                          <td title=" "> </td>  
  160.                          <td title=" "> </td>  
  161.                          <td title=" "> </td>  
  162.                          <td title=" "> </td>  
  163.                          <td title=" "> </td>  
  164.                          <td title=" "> </td>  
  165.                      </tr>  
  166.                      <tr>  
  167.                          <td><span style="background-color: activecaption; color: aqua; font-weight: bold;"><input id="ContentPlaceHolder1_GridView1_ChbView_11" type="checkbox" name="ctl00$ContentPlaceHolder1$GridView1$ctl13$ChbView" /></span> </td>  
  168.                          <td><span style="background-color: red; color: aqua; font-weight: bold;"><input id="ContentPlaceHolder1_GridView1_ChbUpdate_11" type="checkbox" name="ctl00$ContentPlaceHolder1$GridView1$ctl13$ChbUpdate" /></span> </td>  
  169.                          <td title=" "> </td>  
  170.                          <td title=" "> </td>  
  171.                          <td title=" "> </td>  
  172.                          <td title="Grand Total">Grand Total</td>  
  173.                          <td title="57500">57500</td>  
  174.                          <td title=" "> </td>  
  175.                          <td title=" "> </td>  
  176.                          <td title=" "> </td>  
  177.                          <td title=" "> </td>  
  178.                          <td title=" "> </td>  
  179.                      </tr>  
  180.                  </tbody>  
  181.              </table>  
  182.              </div>  
  183.              </div>  
  184.              </td>  
  185.          </tr>  
  186.          <tr>  
  187.              <td class="style5"> </td>  
  188.              <td class="style6"> </td>  
  189.              <td> </td>  
  190.          </tr>  
  191.      </tbody>  
  192. </table>  
 

Answers (1)