Manoj Mandal

Manoj Mandal

  • 1.3k
  • 457
  • 18.9k

pass value to web method

Jun 3 2021 1:26 PM
 i want to pass checkbox value to string res when checkbox is checked.
 
 
[System.Web.Script.Services.ScriptMethod()]
[System.Web.Services.WebMethod]
public static List<string> GetSearch(string prefixText,string res)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["conn"].ConnectionString);
SqlDataAdapter da;
DataTable dt;
DataTable Result = new DataTable();
string str = "Select distinct ITEMNAME from ALLRECIPE where RECIPE IN("+res+") and ITEMNAME like '%" + prefixText + "%'";
da = new SqlDataAdapter(str, con);
dt = new DataTable();
da.Fill(dt);
List<string> Output = new List<string>();
for (int i = 0; i < dt.Rows.Count; i++)
Output.Add(dt.Rows[i][0].ToString());
return Output;
}

Answers (1)