how to solved bellow maintain error
Compiler Error Message: CS1061: 'ASP.empdetailsfromdb_aspx' does not contain a definition for 'GridView1_SelectedIndexChanged' and no extension method 'GridView1_SelectedIndexChanged' accepting a first argument of type 'ASP.empdetailsfromdb_aspx' could be found (are you missing a using directive or an assembly reference?)
here is my design code
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="empdetailsfromdb.aspx.cs" Inherits="csvfileupload2.empdetailsfromdb" %>
onselectedindexchanged="GridView1_SelectedIndexChanged">
and here is my back end code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;
using System.IO;
namespace csvfileupload2
{
public partial class empdetailsfromdb : System.Web.UI.Page
{
string str = "Data Source=ANIRUDDHA-PC;Initial Catalog=sark;Integrated Security=True";
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
String strQuery = "SELECT distinct (city) FROM profilesrr";
SqlConnection con = new SqlConnection(str);
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = strQuery;
cmd.Connection = con;
try
{
con.Open();
DropDownList1.DataSource = cmd.ExecuteReader();
DropDownList1.DataTextField = "city";
DropDownList1.DataValueField = "city";
DropDownList1.DataBind();
// DropDownList2.SelectedIndex = 1;
}
catch (Exception ex)
{
throw ex;
}
finally
{
con.Close();
// con.Dispose();
}
}
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
String strQuery = "SELECT distinct (first_name) FROM profilesrr";
SqlConnection con = new SqlConnection(str);
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = strQuery;
cmd.Connection = con;
try
{
con.Open();
DropDownList2.DataSource = cmd.ExecuteReader();
DropDownList2.DataTextField = "first_name";
DropDownList2.DataValueField = "first_name";
DropDownList2.DataBind();
// DropDownList2.SelectedIndex = 1;
}
catch (Exception ex)
{
throw ex;
}
finally
{
con.Close();
con.Dispose();
}
}
protected void Button1_Click(object sender, EventArgs e)
{
string str = "Data Source=ANIRUDDHA-PC;Initial Catalog=sark;Integrated Security=True";
SqlConnection con = new SqlConnection(str);
SqlCommand cmd = new SqlCommand("select * from profilesrr where city = '" + DropDownList1.SelectedValue + "' and first_name='" + DropDownList2.SelectedValue + "'", con);
SqlDataAdapter Adpt = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
Adpt.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
}
protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
{
//code for DropDownList2_SelectedIndexChanged
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
}
please help me
Raja TRank #685 · 3.5K reputationPosted Jul 13, 2015, 4:25 AM EDT
Rajeesh MenothRank #118 · 18.4K reputationPosted Jul 13, 2015, 3:09 AM EDT
Raja TRank #685 · 3.5K reputationPosted Jul 13, 2015, 3:19 AM EDT
Posted Jul 13, 2015, 3:19 AM EDT
Rajeesh MenothRank #118 · 18.4K reputationPosted Jul 13, 2015, 3:24 AM EDT
Raja TRank #685 · 3.5K reputationPosted Jul 13, 2015, 3:30 AM EDT
Sathish KumarRank #1,932 · 760 reputationPosted Jul 13, 2015, 3:35 AM EDT
Posted Jul 13, 2015, 3:37 AM EDT
Posted Jul 13, 2015, 3:42 AM EDT
Sathish KumarRank #1,932 · 760 reputationPosted Jul 13, 2015, 3:47 AM EDT
Sathish KumarRank #1,932 · 760 reputationPosted Jul 13, 2015, 3:47 AM EDT
Raja TRank #685 · 3.5K reputationPosted Jul 13, 2015, 3:49 AM EDT
Posted Jul 13, 2015, 3:54 AM EDT
Posted Jul 13, 2015, 3:56 AM EDT
Raja TRank #685 · 3.5K reputationPosted Jul 13, 2015, 3:59 AM EDT
Posted Jul 13, 2015, 4:02 AM EDT
Raja TRank #685 · 3.5K reputationPosted Jul 13, 2015, 4:04 AM EDT
Posted Jul 13, 2015, 4:17 AM EDT
Posted Jul 13, 2015, 4:33 AM EDT
Raja TRank #685 · 3.5K reputationPosted Jul 13, 2015, 4:53 AM EDT
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts