Solved

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

Posted on 2009-06-29
4
249 Views
Last Modified: 2012-05-07
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);

Response.End();

}

Open in new window

0
Comment
Question by:sayguh
  • 3
4 Comments
 
LVL 8

Expert Comment

by:lharrispv
ID: 24738741
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?
0
 
LVL 2

Author Comment

by:sayguh
ID: 24738814
Yes, I've updated my ConnectionString to the real SQL database
0
 
LVL 2

Author Comment

by:sayguh
ID: 24738857
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..

confused...
0
 
LVL 2

Accepted Solution

by:
sayguh earned 0 total points
ID: 24738948
Ahh figured it out.  I didn't have the new database table auto-incrementing properly.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now