This is a migrated thread and some comments may be shown as answers.

AutoPostBackOnFilter="true" is disabled when adding client event handler to filter textbox

2 Answers 55 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Igor Ashmetkov
Top achievements
Rank 1
Igor Ashmetkov asked on 02 Nov 2013, 06:14 PM
    Hello,
I am using Radgid with filtering. I Have column^
<telerik:GridBoundColumn UniqueName="FULLNAME" CurrentFilterFunction="Contains" ShowFilterIcon="false" AutoPostBackOnFilter="true" />

Autopostback work right untill I add client event handler:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
  if (e.Item is GridFilteringItem)
  {
    GridFilteringItem filterItem = (GridFilteringItem )e.Item;
    (filterItem["FULLNAME"].Controls[0] as TextBox).Attributes.Add("onchange", "CharacterCheck(this, event)");
  }
}
function CharacterCheck(text, e) {
   text.value = text.value.replace(/[^0-9a-zA-Z]/gi, '');
}

After this postback doesn`t raise when I leave focus on filter textbox. How can I resolve this? Can I raise postback mnualy?

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 04 Nov 2013, 06:45 AM
Hi ,

Please attach the CharacterCheck function to the OnBlur event of the TextBox.

C#:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
  if (e.Item is GridFilteringItem)
  {
    GridFilteringItem filterItem = (GridFilteringItem )e.Item;
    (filterItem["FULLNAME"].Controls[0] as TextBox).Attributes.Add("OnBlur", "CharacterCheck(this, event)");
  }
}

Hope this helps.

Thanks,
Shinu
0
Igor Ashmetkov
Top achievements
Rank 1
answered on 04 Nov 2013, 08:37 AM
Thanks! It`s work!
Tags
Grid
Asked by
Igor Ashmetkov
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Igor Ashmetkov
Top achievements
Rank 1
Share this question
or