2011-12-06 4 views
0

グリッドビューはWebユーザーコントロール内にあり、それらを選択して特定の行を編集できます。グリッドビューの特定の行を選択します。グリッドビューはWebユーザーコントロールにあります。

Webユーザーコントロールの(た.ascx)である:

<div class="project_data"> 
    <asp:GridView runat="server" ID="grvBranches" GridLines="None" CellPadding="5" OnRowDataBound="grvBranches_RowDataBound"> 
     <SelectedRowStyle BackColor="#d8d8d8" /> 
     <HeaderStyle BackColor="#d8d8d8" /> 
    </asp:GridView> 
</div> 

と.ascs.csページで

protected void Page_Load(object sender, EventArgs e) 
     { 
      int.TryParse(OrganizationID, out OrgId); 
      //if (!(Page.IsPostBack)) 
      { 

       grvBranches.DataSource = //datasource; 
       grvBranches.DataBind(); 
      } 
     } 

と私はにこのコントロールを追加した.aspx.csページでプレースホルダー。 私はその行を編集できるように特定のものを選択したいと思います。

ありがとうございました。 Gurbax

+0

jqueryを使用して特定の行を選択しますか? –

+0

可能であれば私にとっては最高です –

答えて

1

あなたはユーザーコントロールが含まれているページ内のjQueryをrefrenceすることができ、その後、あなたが行を選択した後、このいずれかを含むページまたはユーザーコントロールiteself

サンプルコード

<script type="text/javascript"> 
      $(document).ready(function() { 
       //This will select the 2nd row specified by tr:nth-child selector 
       //and then the tablecells specified by children() and first column 
       //specified by eq(0) and get its value 
       $('table[id$="GridView1"] tr:nth-child(2)').children().eq(0).Text(); 
      }); 
     </script> 

を行うことができますjqueryを使用して任意の操作を行うことができます。

希望します。

関連する問題