DataKeys[currentRowIndex].Value works on Development Server but not IIS?

I've been working on the local development server that comes with Visual Web Developer and have the following code working properly.

However, when I move to IIS and load the page, I don't get any error messages but newsID is blank!

Any ideas??
protected void GridView1_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
string currentCommand = e.CommandName;
int currentRowIndex = Convert.ToInt32(e.CommandArgument);
string newsID = gv.DataKeys[currentRowIndex].Value.ToString();
Response.Write("NewsID = " + newsID);

Open in new window

Who is Participating?
sayguhConnect With a Mentor Author Commented:
Ahh figured it out.  I didn't have the new database table auto-incrementing properly.
I know it is a dumb question but are you sure you brought your data connection over with you from the old server to the new server?
sayguhAuthor Commented:
Yes, I've updated my ConnectionString to the real SQL database
sayguhAuthor Commented:
Also, I have a deletecommand on the gridview which works on development but not on LIVE either.

It just refreshesh the page (no error message) but is not deleting the record ???

The gridview is populating with data so the database connection is definitely working..

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.