Reputation: 411
I would like to create a masked textbox (user control) using a jquery plugin but I want to send parameters from my aspx page to my ascx file in order to call a javascript function which has parameters like the mask, the placeholder, etc ...
This is my line of code in my aspx page :
<UC:MaskedTextBox runat="server" ID="MaskedTextBox1" Mask="9999" Placeholder="_" Text="1234" />
This is what I have in my asxs file :
<script type="text/javascript">
$(document).ready(function () {CreateMaskedTextBox('" + _Id + "', '" + _Mask + "', '" + _Placeholder + "', '" + _Text + "');});
</script>
<asp:TextBox ID="MaskedTextBox_TextBox" runat="server"></asp:TextBox>
How can i get the id, mask, placeholder that I have initialized in the aspx page ?
Upvotes: 0
Views: 148
Reputation: 4919
Declare properties in the code behind like this:
public string PlaceHolder { get; set; }
Do it for each parameter you need. You can check this question too: Pass data from a ASP.NET page to ASCX user controls loaded dynamically
Upvotes: 1