perhaps you need to change your code to something like this:
Change your code as followed
private static void GetDetails(HiddenField field)
{
txtAccreditation.Text = field.Value ;
}
and call it like this
Page page = (Page)HttpContext.Current.Handler;
HiddenField hdnUserID = (HiddenField)page.FindControl("hdnUserID");
YourClassName.GetDetails(hdnUserId);
What I do not understand is why would you call it through a static operation.
I would assume you create something more like the following code:
private static string GetDetails(HiddenField field)
{
return field.Value ;
}
This would result in the following code: This code will not be present inside the static function.
Page page = (Page)HttpContext.Current.Handler;
HiddenField hdnUserID = (HiddenField)page.FindControl("hdnUserID");
txtAccreditation.Text = YourClassName.GetDetails(hdnUserId);
meaning you could actually use the code everywhere else