15,917,618 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by ketfos1 (Top 3 by date)
ketfos1
8-Nov-12 8:59am
View
-- removed by digimanus and set in question
ketfos1
30-Oct-12 1:34am
View
Here is the code and error is " The name gvFiles do not exist in the current context".
I am getting this error while I render grid control statement.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OracleClient;
using System.IO;
using System.Data.SqlClient;
namespace Oracleconnect1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
string test1 = "Data Source=test;User Id=test;Password=test123;"; // C#
private void button1_Click(object sender, EventArgs e)
{
OracleConnection conn = new OracleConnection(test1);
{ conn.Open();
label1.Text = conn.State.ToString();
OracleCommand oc = conn.CreateCommand();
oc.CommandText = "SELECT * FROM county where rownum < 10 and policy_year =" + textBox1.Text ;
OracleDataReader reader = oc.ExecuteReader();
bindingSource1.DataSource = reader;
dataGridView1.DataSource = bindingSource1;
dataGridView1.BorderStyle = BorderStyle.Fixed3D;
dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
}
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
System.IO.StringWriter sw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htw = new System.Web.UI.HtmlTextWriter(sw);
// Render grid view control.
gvFiles.RenderControl(htw);
// Write the rendered removed to a file.
string renderedGridView = sw.ToString();
File.WriteAllText(@"C:\temp\ExportedFile.xlsx", renderedGridView);
}
ketfos1
29-Oct-12 23:25pm
View
I have added this code in the button click and I am getting error message
"The name Response does not exist in current context"
"The name GridView doesnot exisit in current context"