Ramco Ramco

Ramco Ramco

  • 436
  • 3.4k
  • 546.5k

Unable to cast object of type 'System.Web.UI.WebControls.HiddenField'

Apr 17 2022 4:38 PM

Hi

  In below line i am getting error

List Result = bALSessionRatingParameter.GetSessionRatingParameter(Convert.ToInt32(hf));

protected void lnkSelect_Click(object sender, EventArgs e)
{
    var repeaterItem = ((Control)sender).NamingContainer;
    HiddenField hf = (HiddenField)repeaterItem.FindControl("hdfId");
    BALSessionRatingParameter bALSessionRatingParameter = new BALSessionRatingParameter();
    List<SessionRatingParameter> Result = bALSessionRatingParameter.GetSessionRatingParameter(Convert.ToInt32(hf));
    rptRating.DataSource = Result;
    rptRating.DataBind();
}

Thanks


Answers (2)