1

I have created a multidimensional array.I wants to display it in the .aspx page. please help.my code is here.It doesnt shows the array values

    string[,] array_questions = new string[dt.Rows.Count, dt.Columns.Count];

    for (i = 0; i < dt.Rows.Count; i++)
    {
        for (j = 0; j < dt.Columns.Count; j++)
        {
            array_questions[i, j] = dt.Rows[i][j].ToString();

            //TextBox1.Text = array_questions[i,j];
        }
    } 
    Console.Write(array_questions[i, j] + " ");
1
  • Are you writing this in an event handler such as Load? Commented Jun 4, 2013 at 6:41

4 Answers 4

1

you can also use Response.write

Sign up to request clarification or add additional context in comments.

2 Comments

why write a similar response to mine? ^ ^
your respone and my response didn't have a minute diff ? I haven't seen yours you can see that
1

Console.Write is used for console applications. If you want to display the data on the aspx webpage you need to create a webcontrol (for example label) and set its text property with an appropriate value.

1 Comment

the op is asking exactly how to do this, show some example code would be very helpful.
1

If you want to write the values ​​in the table in the console visual studio, call the method

Console.Out.Write() and not Console.Write(). Otherwise call Response.Write() to write on the page

Comments

0
        // display the array

        for (int i = 0; i < array_questions.GetLength(0); i++)
        {
            for (int j = 0; j < array_questions.GetLength(1); j++)
            {
                Response.Write("i="+i+"   "+"j="+j);
                Response.Write("<br>");

            }
        }

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.