We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

RowFilter error

When i am applying row filter using dataview for the DataBoundGrid i m getting below error for 2 filter rest of the filters are working. Cannot perform ''>'' operation on System.String and System.Int32. at System.Data.BinaryNode.SetTypeMismatchError(Int32 op, Type left, Type right) at System.Data.BinaryNode.Compare(Object vLeft, Object vRight, Type type, Int32 op) at System.Data.BinaryNode.EvalBinaryOp(Int32 op, ExpressionNode left, ExpressionNode right, DataRow row, DataRowVersion version, Int32[] recordNos) at System.Data.BinaryNode.Eval(DataRow row, DataRowVersion version) at System.Data.DataFilter.Invoke(DataRow row, DataRowVersion version) at System.Data.Index.AcceptRecord(Int32 record) at System.Data.Index.InitRecords() at System.Data.Index..ctor(DataTable table, Int32[] indexDesc, DataViewRowState recordStates, IFilter rowFilter) at System.Data.DataTable.GetIndex(Int32[] indexDesc, DataViewRowState recordStates, IFilter rowFilter) at System.Data.DataView.UpdateIndex(Boolean force) at System.Data.DataView.SetIndex(String newSort, DataViewRowState newRowStates, DataFilter newRowFilter) at System.Data.DataView.set_RowFilter(String value) at Slb.Horizon.UI.Applications.WFTI.SlbWFTIPretestListingUI.FilterRows() at Slb.Horizon.UI.Applications.WFTI.SlbWFTIPretestListingUI.m_BtnApplyRowFilter_ClickEventHandler(Object sender, EventArgs e) at System.EventHandler.Invoke(Object sender, EventArgs e) at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

3 Replies

AD Administrator Syncfusion Team January 4, 2005 04:09 AM

From the error, it looks like you are trying to say something like dataView1.RowFilter = "[Col1] > 14" where the Col1 DataColumn in your DataTable is of type string. So, take a look at the help on DataColumn.Expression. It shows the syntax that is permissable for Expression and this is the same as for RowFilter. I think you woul dneed to use the Convert function to convert teh string into an integer before you try to compare it to another integer.


AD Administrator Syncfusion Team October 17, 2008 09:12 AM

hi...
i m also getting the error "Cannot perform '=' operation on System.String and System.Int32."

can u plz tell me what could be the reason for this how to solve this.

the datatype of column
patientid ------bigint
forename--------varchar(35)
salutation------varchar(35)

what i m trying to do in page_load is like this.

protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
BindGrid();
}

}


public void BindGrid()
{
try
{
string ConnectionString = ConfigurationManager.ConnectionStrings["xxx"].ConnectionString;
SqlConnection myCon = new SqlConnection(ConnectionString);
myCon.Open();
SqlCommand myCmd = (SqlCommand)myCon.CreateCommand();
myCmd.CommandType = CommandType.Text;
string strsql = "Select patientid,forename,salutation from TableA";
myCmd.CommandText = strsql;
SqlDataAdapter da = new SqlDataAdapter(myCmd);
DataSet ds = new DataSet();
da.Fill(ds, "MyTable");
GridView1.DataSource = ds;
GridView1.DataBind();
}
catch (Exception ex)
{
string strException = ex.Message.ToString();
}

}

in aspx page:


forecolor="Khaki" font-bold="True" />












 





Width="71px">






<%--

DataSource='<%# BindSalutation() %>' DataTextField="SalutationType" DataValueField="SalutationType" SelectedValue='<%# Bind("SalutationType") %>' >


--%>











JJ Jisha Joy Syncfusion Team October 20, 2008 02:24 AM

Hi Hashmat,

Could you please let me know which Syncfusion control you are using?. We provide support to Syncfusion control only?

Please let me know if you have any questions.

Regards,
Jisha


Loader.
Live Chat Icon For mobile
Up arrow icon