Select all labels with id= "lblID" inside gridview
$('#<%=gdRows.ClientID %>').find('span[id$="lblID"]').text('Your text.');
Select particular label control out of all the labels with id= "lblID" inside gridview
var $arrL = $('#<%=gdRows.ClientID %>').find('span[id$="lblID"]');
var $lbl = $arrL[0];
$($lbl).text('Your text...');
Similarly, you can also find textbox. Select all textbox with id= "txtID" inside gridview
$('#<%=gdRows.ClientID %>').find('input:text[id$="txtID"]').val('Your value.');
Select particular textbox control out of all the textboxes with id="txtID" inside gridview
var $arrT = $('#<%=gdRows.ClientID %>').find('input:text[id$="txtID"]');
var $txt = $arrT[0];
$($txt).val('text...');
//HTML
<asp:GridView runat="server" ID="dgv" AutoGenerateColumns="False" ShowFooter="true">
    <Columns>
        <asp:BoundField DataField="id"
HeaderText="id"
/>
        <asp:TemplateField HeaderText="from">
            <ItemTemplate>
              
<asp:TextBox ID="txtfromff"
runat="server"></asp:TextBox>
            </ItemTemplate>
            <FooterTemplate>
            <asp:TextBox ID="txt_from"
class="d_from"
runat="server"></asp:TextBox>
            </FooterTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="to"> 
            <ItemTemplate>
            <asp:TextBox ID="txttott"  runat="server"></asp:TextBox>
            </ItemTemplate>
            <FooterTemplate>            
            <asp:TextBox ID="TextBox1"
runat="server"></asp:TextBox>
            </FooterTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>
//Script
<script type="text/javascript">
function SetDissVenderValue() {
                   
var ddlvalue = $('#<%=ddl_venderDiss.ClientID%> option:selected').text();
                   
var $arrT = $('#<%=DGV_Dissimination.ClientID
%>').find('input:text[id$="txt_vender"]');
                   
var $txt = $arrT[0];
                   
$($txt).val(ddlvalue);
                   
$find('showselecven').hide();
                   
return false;
               
}
 
No comments:
Post a Comment