Noob C sharp question

Associate
Joined
5 Apr 2003
Posts
1,420
Hi guys im making an ASP.net page in c sharp on VS. I've made up code to build myself a table, a 9x9 grid. I can't get it to:

- Make each cell blank it just says "Submit Query" in each of them
for
(int col = 0; col < 9; col++)
{
board[row, col] = 0;
}

This wont seem to work it does the above error. Any ideas here?

I've also got a popup window that has buttons inside it, so when u click a cell it shows the keypad to enter the value u want in that cell, but i can't get the popup to stay visible it just appears when u click and then goes! I want it to hold until the user clicks a value.

If anyone can assist with these problems that would be amazing! If anything is not clear please ask and i'll try explain it better!

Thanks, Nick
 
any chance i could add u to msn or something, because its quite a lot of code from different files Welshy? or any email i could send it to?
 
Last edited:
Ok i've managed to sort those gay problems out! Basically it was because my VS2005 had firefox as default browser and not IE... ridiculous!

Next question :D! Now i've got my 9x9 grid up and running, i'm wanting to put a border round every seperate 3x3 grid in there so it looks like a sudoku grid.
This is part of it to create the board so i guess i needs to go here:


int[,] board;
protected void Page_Load(object sender, EventArgs e)
{
// register javascript
Page.ClientScript.RegisterClientScriptInclude("jsLib", "PopupLib.js");
if (IsPostBack)
{
board = (int[,])Session[ModelKey];
}
else
{
board = new int[9, 9];
Random rnd = new Random(DateTime.Now.Millisecond);
for (int row = 0; row < 9; row++)
{
for (int col = 0; col < 9; col++)
{
board[row, col] = 0;
}
}
Session[ModelKey] = board;
}

Popup.Style[HtmlTextWriterStyle.Visibility ] = "hidden";

for (int row = 0; row < 9; row++)
{
TableRow trow = new TableRow();
SudokuTable.Rows.Add(trow);
for (int col = 0; col < 9; col++)
{
TableCell tcell = new TableCell();
SudokuButton sb = new SudokuButton(row, col);
sb.ImageUrl = string.Format(path, board[row,col]);
sb.Width = sb.Height = Unit.Pixel(50);
tcell.Controls.Add(sb);
trow.Cells.Add(tcell);
sb.OnClientClick = " return movePopup(this);";
}
}

Anyone got any ideas how i might be able to implement this?

Thanks in advance, Nick
 
Back
Top Bottom