0
I need to implement a mask (value) in n Textbox fields (defined by n periods x n contracts) within a grid, where they are generated dynamically. I use jQuery for static textboxes (Autonumeric). But I don’t know how to reference them dynamically, since I need Clientid for autonumeric to work.
Excerpt from the script that uses autoNumeric in a Static Textbox: (.aspx)
$("#<%=txtValor.ClientID%>").autoNumeric({ aSep: '.', aDec: ',' });
Method in code-Behind in which Gero a dynamic textbox (.Cs):
private TextBox geraTextBox(string periodo, string linha)
{
TextBox textBox = new TextBox();
textBox.ID = periodo + "_" + linha;
textBox.Width = 50;
textBox.AutoPostBack = true;
textBox.TextChanged += new EventHandler(txtBoxes_TextChanged);
textBox.ReadOnly = false;
return textBox;
}
Note: I apologize for any syntax/user error of Stack Overflow. This is the first time I ask a question.
The most correct way would be to create a new control and implement the interface
IScriptControl
. Take a look at this link. It is in VB, but in general it is the same thing. You can also add an attribute in the textbox, which implements the load method of javascript.– Bruno Warmling
I will use the first strategy and then pass the result
– rmzanco