Part of my gridview looks like this:
<asp:TemplateField HeaderText="Mortality Rate" SortExpression="Other2">
<EditItemTemplate >
<asp:TextBox ID="txtAppLimit" Text='<%#Bind("Other2")%>' runat="server" width="60px" maxlength="14">
</asp:TextBox>
<asp:RangeValidator ID="RVAppLimit" Type="Currency" runat="server" ControlToValidate="txtAppLimit"
Display="Dynamic" ErrorMessage="" Font-Size="8pt"
CssClass="msgerror" MinimumValue="0" MaximumValue="200" OnPreRender="GridView1_PreRender" ValidationGroup="group1">
</asp:RangeValidator>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblAppLimit" Runat="server" Text='<%# Bind("Other2") %>' >
</asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Right" Width="10%" />
</asp:TemplateField>
I'm trying to get the asp TextBox ID and asp Label ID in this way when I click on a asp LinkButton:
var $arrL = $('#<%=GridView1.ClientID %>').find('span[id$="lblAppLimit"]');
var $lbl = $arrL[0];
($lbl).disabled = true;
alert (($lbl).disabled);
var $arrT = $('#<%=GridView1.ClientID %>').find('input:text[id$="txtAppLimit"]').val();
var $txt = $arrT[0];
alert (($txt).innerHTML);
I have no problem disabling lblAppLimit, however I'm not able to get the textbox ID to disable it. What is wrong with my code above?
Just to add on another note, when I click on view source on my browser, I'm able to see lblAppLimit, but not txtAppLimit.
txtAppLimitis inEditItemTemplateso it will only work if the grid is in edit mode