i created a text-box through the code behind but was unable to add a text-changed event to it
here is what i
protected void insert(object sender, EventArgs e)
{
}
protected void update(object sender, DayRenderEventArgs e)
{
TextBox tb = new TextBox();
tb.TextChanged += "insert";
e.Cell.Controls.Add(tb);
}
i tried this but it didn’t work for me.
what is the problem, thanks
When you want to bind a handler to an event in code-behind, what you actually do is to write the name of the handler itself, not a string
To make a little more clear, imagine that C# has a list called
EventHandler, and every time the text changes on the text box (blur event in client side), C# executes all the methods inside that list. Now, how do you add a method to that list? You use+=operator. Now, if you want to add two handlers, you can write: