Solved

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

Posted on 2009-06-29
4
248 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Summernote and form validation 10 42
Where to begin studying? 5 66
Image(7) 1 37
ConsoleSql 1 18
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 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

20 Experts available now in Live!

Get 1:1 Help Now