hi
Very urgent please help me
i have implemented custom search in itemCommed event in my grid. but i could not execute that its getting error in "Expression expected" i checked all the possibility but i could not correct it. At the same time i implemented grouping that grouping working fine there is no issue. But searching only i have problem. please check it and let me know as soon as possible
below i pasted my c# code as well as asp.net code
c#
protected void RadGridMsgInbox_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
{
e.Canceled = true;
Button btnG = (Button)e.Item.FindControl("btnGeneral");
Button btnI = (Button)e.Item.FindControl("btnGeneral");
Button btnN = (Button)e.Item.FindControl("btnGeneral");
switch (e.CommandName)
{
// THIS CASE FIRE WHEN GRID SEARCH EVENT ACCOUR
case "SearchUsersBy":
TextBox txtSearch = (TextBox)e.Item.FindControl("txtSearch");
RadioButton rdbtnFrom = (RadioButton)e.Item.FindControl("rdbtnFrom");
RadioButton rdbtnSubject = (RadioButton)e.Item.FindControl("rdbtnSubject");
ObjCC_Msg.MsgSearchStr = "";
if (rdbtnFrom.Checked)
this.RadGridMsgInbox.MasterTableView.FilterExpression = "([SentEmail] LIKE '%" + txtSearch.Text + "%')";
else if(rdbtnSubject .Checked )
this.RadGridMsgInbox.MasterTableView.FilterExpression = "( [MessageSubject] LIKE '%" + txtSearch.Text + "%' )";
else
this.RadGridMsgInbox.MasterTableView.FilterExpression = "(([MessageSubject] LIKE '%" + txtSearch.Text + "%') OR ([SENTEMAIL] LIKE '%" + txtSearch.Text + "%'))";
if (RTbMessageMenu.SelectedIndex == 1)
ObjCC_Msg.GetMessage = FromMessage.Sent;
//RadGridMsgInbox.MasterTableView.GroupByExpressions.Clear();
//RadGridMsgInbox.MasterTableView.Rebind();
RadGridMsgInbox.Rebind();
break;
}
}
ASP.NET Code
<CommandItemTemplate>
<table cellpadding="0" cellspacing="0" border="0" width="98%">
<tr>
<td style ="width :30%">
<table border="0" cellpadding="0" cellspacing="0" width ="100%">
<tr>
<td style ="width :90%">
<asp:TextBox ID="txtSearch" runat="server" Width ="90%"></asp:TextBox> </td>
<td style ="width :10%">
<asp:Button ID="lnkBtnSearch" CssClass="mainSearchBtn" runat="server" Text="" CommandName ="SearchUsersBy"></asp:Button>
</td>
</tr>
<tr>
<td colspan ="2">
<asp:RadioButton ID="btnAll" runat ="server" Text ="All" GroupName ="Search" Checked ="true" />
<asp:RadioButton ID="rdbtnFrom" runat ="server" Text ="From" GroupName ="Search" />
<asp:RadioButton ID="rdbtnSubject" runat ="server" Text ="Subject" GroupName ="Search" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</CommandItemTemplate>
*Note: Here i attached my error screen please go through that
i am waiting for your reply
Very urgent please help me
i have implemented custom search in itemCommed event in my grid. but i could not execute that its getting error in "Expression expected" i checked all the possibility but i could not correct it. At the same time i implemented grouping that grouping working fine there is no issue. But searching only i have problem. please check it and let me know as soon as possible
below i pasted my c# code as well as asp.net code
c#
protected void RadGridMsgInbox_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
{
e.Canceled = true;
Button btnG = (Button)e.Item.FindControl("btnGeneral");
Button btnI = (Button)e.Item.FindControl("btnGeneral");
Button btnN = (Button)e.Item.FindControl("btnGeneral");
switch (e.CommandName)
{
// THIS CASE FIRE WHEN GRID SEARCH EVENT ACCOUR
case "SearchUsersBy":
TextBox txtSearch = (TextBox)e.Item.FindControl("txtSearch");
RadioButton rdbtnFrom = (RadioButton)e.Item.FindControl("rdbtnFrom");
RadioButton rdbtnSubject = (RadioButton)e.Item.FindControl("rdbtnSubject");
ObjCC_Msg.MsgSearchStr = "";
if (rdbtnFrom.Checked)
this.RadGridMsgInbox.MasterTableView.FilterExpression = "([SentEmail] LIKE '%" + txtSearch.Text + "%')";
else if(rdbtnSubject .Checked )
this.RadGridMsgInbox.MasterTableView.FilterExpression = "( [MessageSubject] LIKE '%" + txtSearch.Text + "%' )";
else
this.RadGridMsgInbox.MasterTableView.FilterExpression = "(([MessageSubject] LIKE '%" + txtSearch.Text + "%') OR ([SENTEMAIL] LIKE '%" + txtSearch.Text + "%'))";
if (RTbMessageMenu.SelectedIndex == 1)
ObjCC_Msg.GetMessage = FromMessage.Sent;
//RadGridMsgInbox.MasterTableView.GroupByExpressions.Clear();
//RadGridMsgInbox.MasterTableView.Rebind();
RadGridMsgInbox.Rebind();
break;
}
}
ASP.NET Code
<CommandItemTemplate>
<table cellpadding="0" cellspacing="0" border="0" width="98%">
<tr>
<td style ="width :30%">
<table border="0" cellpadding="0" cellspacing="0" width ="100%">
<tr>
<td style ="width :90%">
<asp:TextBox ID="txtSearch" runat="server" Width ="90%"></asp:TextBox> </td>
<td style ="width :10%">
<asp:Button ID="lnkBtnSearch" CssClass="mainSearchBtn" runat="server" Text="" CommandName ="SearchUsersBy"></asp:Button>
</td>
</tr>
<tr>
<td colspan ="2">
<asp:RadioButton ID="btnAll" runat ="server" Text ="All" GroupName ="Search" Checked ="true" />
<asp:RadioButton ID="rdbtnFrom" runat ="server" Text ="From" GroupName ="Search" />
<asp:RadioButton ID="rdbtnSubject" runat ="server" Text ="Subject" GroupName ="Search" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</CommandItemTemplate>
*Note: Here i attached my error screen please go through that
i am waiting for your reply