Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6044327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:59:56+00:00 2026-05-23T06:59:56+00:00

foreach (var item in AnketSoru) { r = new HtmlTableRow(); c = new HtmlTableCell();

  • 0
            foreach (var item in AnketSoru)
        {
            r = new HtmlTableRow();
            c = new HtmlTableCell();
            c.InnerHtml = item.new_question_text.ToString();
            r.Cells.Add(c);

            switch (item.new_question_type.ToString())
            {
                case "2": //FreeText
                    c = new HtmlTableCell();
                    TxtFreeText = new TextBox();
                    TxtFreeText.ID = "Txt_" + item.new_survey_questionid.ToString();
                    TxtFreeText.TextMode = TextBoxMode.MultiLine;
                    TxtFreeText.Width = 300;
                    TxtFreeText.Height = 50;
                    TxtFreeText.EnableViewState = true;
                    c.Controls.Add(TxtFreeText);

                    HiddenField txthfield = new HiddenField();
                    txthfield.Value = item.new_name.ToString();
                    c.Controls.Add(txthfield);

and

                foreach (Control c in plc.Controls)
            {
                System.Web.UI.HtmlControls.HtmlTable Survey_Inner = (System.Web.UI.HtmlControls.HtmlTable)c.FindControl("Survey_Inner");

                foreach (System.Web.UI.HtmlControls.HtmlTableRow r in Survey_Inner.Rows)
                {
                    foreach (Control ctr in r.Cells)
                    {
                        foreach (Control ct in ctr.Controls)
                        {
                            if (ct.GetType().ToString() == "System.Web.UI.WebControls.TextBox")
                            {

                                string freeTxtQues = ?? ;

                                string TextCevap = ((System.Web.UI.WebControls.TextBox)ct).Text;

                                string deger = ct.ID.ToString();



                                Guid QuestionId = new Guid(deger.Substring(4));

                                SaveAnswers(this._PortalUserHelper.UserProxy.ContactId, EgitimKatilimcisi, QuestionId, TextCevap, freeTxtQues);

                            }

i tryed

string freeTxtQues = ((System.Web.UI.WebControls.HiddenField)ct).Value;

but returns me error. “InvalidCastException was unhandled by user code.”

‘System.Web.UI.WebControls.TextBox’ türündeki nesne ‘System.Web.UI.WebControls.HiddenField’ türüne atılamadı.

I’m trying to reach hiddenfields value’s and set them to the freeTxtQues value but couldn’t able to do it for now. Any help for how can i do that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T06:59:56+00:00Added an answer on May 23, 2026 at 6:59 am

    Hard to understand your question/problem but I will throw something…

    When you create dynamic controls you need to create them on Init event so when ViewState is applied he finds the controls and sets their values. If you are not creating the controls in Init but later, you will found out that the control doesn’t have the supposed value!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code: foreach (var item in ListView1.Items) { ListView1.Items.Remove(item); ListView21.Items.Add(item); } the
List<string> liste = new List<String> { A,B,C,D }; foreach (var item in liste) {
for example foreach (var item in List<int> a) { b.add(item); c+=item; dosomething(); } how
Imagine that during a foreach(var item in enumerable) The enumerable items change. It will
string x; foreach(var item in collection) { x += item+,; } can I write
I have the following in my view: <%using (Html.BeginForm()) {%> <% foreach (var item
I have select values as follows: <select id=SelectBox multiple=multiple> <% foreach (var item in
foreach (var person in peopleList.Where(person => person.FirstName == Messi)) { selectPeople.Add(person); } I am
How do I do this in linq? var p = new pmaker(); foreach (var
foreach (var item in ((ModelBase)Model).Stylesheets) { %> <%=item.url %> <link rel=stylesheet type=text/css href=<%= Url.Content(item.url)%>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.