TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
john kanyora
NA
242
46.2k
data not loading in gridview
Feb 26 2018 1:26 AM
Hi, i have a code that is using radiobutton to get data from a data table..i want once you click on the radiobutton it display the data on the gridview but it is not doing so..kindly help..below is the code am using.
protected
void
Radiobuttonlist1_CheckedChange(Object sender, EventArgs e)
{
string
Value = Radiobuttonlist1.SelectedItem.Value.ToString();
if
(Value ==
"Patients"
)
{
string
connect = TraceBizCommon.Configuration.ConfigSettings.ConnectionString;
SqlConnection conn =
new
SqlConnection(connect);
conn.Open();
SqlCommand cmd =
new
SqlCommand(
"select PatientName,PatientCellPhone from CustomerInformation"
, conn);
SqlDataAdapter da =
new
SqlDataAdapter(cmd);
DataSet ds =
new
DataSet();
da.Fill(ds);
conn.Close();
GridView1.DataSource = ds;
GridView1.DataBind();
}
else
if
(Value==
"Suppliers"
)
{
string
connect = TraceBizCommon.Configuration.ConfigSettings.ConnectionString;
SqlConnection conn =
new
SqlConnection(connect);
conn.Open();
SqlCommand cmd =
new
SqlCommand(
"select VendorName,VendorPhone from VendorInformation"
, conn);
SqlDataAdapter da =
new
SqlDataAdapter(cmd);
DataSet ds =
new
DataSet();
da.Fill(ds);
conn.Close();
GridView1.DataSource = ds;
GridView1.DataBind();
}
else
if
( Value==
"Employees"
)
{
string
connect = TraceBizCommon.Configuration.ConfigSettings.ConnectionString;
SqlConnection conn =
new
SqlConnection(connect);
conn.Open();
SqlCommand cmd =
new
SqlCommand(
"select EmployeeName,EmployeeMobilePhone from PayrollEmployees"
, conn);
SqlDataAdapter da =
new
SqlDataAdapter(cmd);
DataSet ds =
new
DataSet();
da.Fill(ds);
conn.Close();
GridView1.DataSource = ds;
GridView1.DataBind();
}
}
Reply
Answers (
2
)
My GridVIew Is Not Work I Can'n Perform Edit and delete?
How to call generic handler with 2 parameters in webforms