文本框已更改事件未在复合控件中触发....
问题描述:
即时创建一个复合控件,其中....
i m creating a Composite control in which ....
public RadGrid Grid = new RadGrid();
private RadTextBox txtbox = new RadTextBox();
protected override void CreateChildControls()
{
txtbox.TextChanged += new EventHandler(txtbox_TextChanged);
Controls.Add(txtbox);
Controls.Add(Grid);
txtbox.AutoPostBack = true;
txtbox.Attributes.Add("onkeyup","SendTextBox():");
}
protected override void OnPreRender(EventArgs e)
{
ClientScriptManager cs = Page.ClientScript;
cs.RegisterStartupScript(this.GetType(), "SendTextBox", "setTimeout('__doPostBack(\'" + txtbox.ID + "\',\'\')', 0);", true);
base.OnPreRender(e);
}
protected void txtbox_TextChanged(object sender, EventArgs e)
{
// code for searching in grid
Grid.Rebind();
}
当我写入txtbox时... txtbox_textChanged事件未被触发..请帮助
when i write in txtbox ...txtbox_textChanged event is not fired ..Please Help
答
请添加Autopostback =对于该Textbox是正确的,那么textchanged事件肯定会起作用。
u可以在该控件的属性中更改它。
Please Add Autopostback=true for that Textbox then the textchanged event will work for sure.
u can change it in the property of that control.
Check some of steps
1. If you have used any requiredfied validato or reqular expression (Client Validation)
Then mention in your textbox property CauseValidation="false"
2. Autopostback="true" in textbox property
Hope this will help you