4

I want to create a hidden html field:

string _ResultHidden = "";

var Detail_Like = MainClass.objFestivalImageLike.FestivalImageLike_List(MD.User_ID);

foreach (var item in Detail_Like)
{

    if (item.Festival_Image_Like_Count == 1)
    {
        _ResultHidden += **@"<asp:HiddenField ID=""hid_" + item.Festival_Image_ID + @""" runat=""server"" Value=""1""></asp:HiddenField>"**;
    }
    else
    {
         _ResultHidden += @"<asp:HiddenField ID=""hid_" + item.Festival_Image_ID + @""" runat=""server"" Value=""0""></asp:HiddenField>";
    }
}

Literal.Text = _ResultHidden;

Now I want access to the hidden field value.

1
  • i am testing: "hid_" + item.Festival_Image_ID.Value not working Commented Apr 16, 2015 at 7:11

1 Answer 1

4

You can create any control from code behind, and add it to page or panel control. for hidden field you can do like this

Code behind:

  HiddenField hf = new HiddenField();
  hf.ID = "myNEwHF";
  hf.Value = "myValue";
  Panel2.Controls.Add(hf); // or Page.Form.Controls.Add(hf);

Html Markup:

   <asp:Panel ID="Panel2" runat="server">
    </asp:Panel>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.