I am looking to compare the values entered in my textbox with the existing values in a gridview. I have achieved this on the server side using the following function:
protected void isRecordAlreadyExist(TextBox txt_Value, int res)
{
ds_main = new DataSet();
paramArray = new string[3, 2];
paramArray[0, 0] = "@KeyWinCountNumber";
paramArray[0, 1] = txtkeyWinCount.Text.Trim();
paramArray[1, 0] = "@ContractNumber";
paramArray[1, 1] = txtContractNum.Text.Trim();
paramArray[2, 0] = "`";
obj = new DalLib();
ds_main = obj.getDataSet("sp_tbl_Contract_MatchValues", paramArray);
gvContract.DataSource = ds_main.Tables[res];
if (ds_main.Tables[res].Rows.Count > 0)
{
mtvResult.ActiveViewIndex = 3;
btnSubmit.Enabled = false;
}
else
{
btnSubmit.Enabled = true;
}
}
protected void txtkeyWinCount_TextChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(txtkeyWinCount.Text))
{
isRecordAlreadyExist(txtkeyWinCount, 0);
}
else
{
mtvResult.ActiveViewIndex = -1;
}
}
However, I would also like to compare the value from the textbox with the gridview data on the client side using JavaScript. How can I achieve this? Any assistance would be greatly appreciated.