Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

One Column of Array Not Populating?

Status
Not open for further replies.

AlexCuse

Programmer
Apr 13, 2006
5,416
US
Hi All

I apologize for yet another dopey question. Using VS2005.

I wasn't sure if I should post this in ASP.net or C# forum, but because it is a ASP.net project I will post here. Basically, I am trying to populate a 6 column array as a gridview on my page databinds. Here is what I am using to do it:

Code:
    protected void dgvDest_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            arDbl[0, e.Row.RowIndex] = e.Row.Cells[0].Text;
            arDbl[1, e.Row.RowIndex] = e.Row.Cells[1].Text;
            arDbl[2, e.Row.RowIndex] = e.Row.Cells[2].Text;
            arDbl[3, e.Row.RowIndex] = e.Row.Cells[3].Text;
            arDbl[4, e.Row.RowIndex] = e.Row.Cells[4].Text;
            arDbl[5, e.Row.RowIndex] = e.Row.Cells[5].Text;
        }
    }

Which worked fine for a 2 column array (populating columns 0 and 1), and it works fine for columns 1-5. But I am using this array to build a javascript funtion that is sent back to my page from the server, and the passed value from only column 0 is coming back "". All the others are populating fine.

The array data type is string (there are no problems with declaration), and each value is actually a number except columns 0 and 1. Col 0 is the longest string in the bunch, but it doesn't exceed more than about 20 characters in what I've been testing on.

Has anyone run into a problem like this before? I am really at a loss here, I've tried explicitly casting the cells[0].text as a string, and everything else I could think of, but to no avail. I have also tried response.write'ing the value read directly from the gridview, but this does not work either (well, I am sure it works, just not like I expected it to ;-) )

Any advice would be greatly appreciated.

Thanks a lot,

Alex

Ignorance of certain subjects is a great part of wisdom
 
Case closed guys, I must have inadvertently set this column to a TemplateColumn, and this was making it so I couldn't read from it via code. Hopefully this will helpd someone else who has the same problem.

I knew it was a dopey question ;-)

Alex

Ignorance of certain subjects is a great part of wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top