I am at the initial stage of learning ASP.NET Webforms as a beginner and I am working with this block of code where I need to invoke Request.QueryString from a static method. But I am not being able to do that and instead it throws a compilation error
This is my block of code
[System.Web.Services.WebMethod]
public static string GetProductImgList(string ProductCode)
{
try
{
string ProductId = Request.QueryString["ID"].ToString(); //error
string BatchId = Request.QueryString["Batch"].ToString();//error
string UserId = Request.QueryString["UID"].ToString();//error
dalOnlineShop objdalOnlineShop = new dalOnlineShop();
DataTable dt = objdalOnlineShop.GetProductAllImgs(ProductCode);
string ImgNames = "";
for (int i = 0; i < dt.Rows.Count; i++)
{
if (dt.Rows.Count == i + 1)
{
ImgNames += dt.Rows[i]["SmallImgPath"].ToString() + ",";
ImgNames += dt.Rows[i]["ImgPath"].ToString();
}
else
{
ImgNames += dt.Rows[i]["SmallImgPath"].ToString() + ",";
ImgNames += dt.Rows[i]["ImgPath"].ToString() + ",";
}
}
return ImgNames;
}
catch (Exception ex) { }
return "";
}