On one of my web pages, I have set up the following:
<%@ Register Src="MyLocationControl.ascx" TagName="MyLocationControl" TagPrefix="uc3" %>
Inside MyLocationControl.ascx, there is a textbox field that will contain hidden values such as name, address, and state.
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MyLocationControl.ascx.cs" Inherits="MyLocationControl" %>
<asp:TextBox ID="uxMyLocationDescription" runat="server" Rows="4" TextMode="MultiLine" ReadOnly="true" Width="225px"/>
<asp:HiddenField ID="MyLocationIDField" runat="server" Visible="true" ClientIDMode="Static" />
In the .cs file, there is a section like this:
public int LocationID
{
get { return this.MyLocationIDField.Value == String.Empty ? 0 : Convert.ToInt32(this.MyLocationIDField.Value); }
set { this.MyLocationIDField.Value = value.ToString(); }
}
I am having trouble accessing the clientID to assign a value to it.
document.getElementById('<%=uc3_MyLocationIDField.ClientID %>').value = "My Value";
However, I can interact with the textbox using the following code...
document.getElementById('MainContentPlaceHolder_uxReservationControl_uxRentalLocation_uxRentalLocationDescription').value = "Put something here";
Could you please help me understand what I might be overlooking?