Quantcast
Viewing latest article 5
Browse Latest Browse All 5

How to Solve This Error 'myLabel' does not exist in the current context

I Am Using Visual Studio 2010

My Aspx Page Contains Code LIke:-

---------------------------------------------------------

<table>
<tr>
<td>
<asp:DropDownList ID="ddlComparePackage2" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlComparePackage2_SelectedIndexChanged">
<asp:ListItem>7 Months</asp:ListItem>
<%--<asp:ListItem>6 Months</asp:ListItem>--%>
</asp:DropDownList>
<div class="clearfix">
</div>
<b>Rs.
<asp:Label ID="lbCost2" runat="server" Text=""></asp:Label>

</b>
<%--<b>
<asp:Label ID="lbCost21" runat="server" Text=""></asp:Label>
</b>--%>
</td>
</tr>
<tr>
<td>
<asp:label id="myLabel" runat="server" />

<%-- <img runat="server" src="images/check.png" />--%>
</td>
</tr>


<tr>
<td>
<asp:Label ID="lblPack2SMS" runat="server" Text=""></asp:Label>
<%--<img src="images/check.png" />--%>
</td>
</tr>
<tr>
<td>
<asp:Image ID="imgvideo1" ImageUrl="~/images/cancel.png" autopostback="true" runat="server" class="img-responsive" style="width:17px" />
<%--<img src="images/check.png" />--%>
</td>
</tr>
<tr>
<td>
<asp:Image ID="IsEmail1" ImageUrl="~/images/cancel.png" autopostback="true" runat="server" class="img-responsive" style="width:17px" />
<%--<img src="images/check.png" />--%>
</td>
</tr>
<tr>
<td>
<asp:Button ID="Button1" runat="server" Text="Select" />
<%--<button class="btn btn-warning" id="btnSelectPackage2" onclick="window.location.href='PaymentOptions.aspx'" type="button" data-toggle="modal" data-target="#PackageDetails">
Select
</button>--%>
</td>
</tr>
</table>

When I try to  Use mylabel  In .CS Page 

 myLabel.Text =dr["NoOfMsgs"].ToString();

I Got Error Like Thie:

Error 60 The name 'myLabel' does not exist in the current context .

How can I Solve This Proble Please Help Me

Thenks & Regards

Samba


Viewing latest article 5
Browse Latest Browse All 5

Trending Articles