Select :
private void BindGrid()
{
var query = from p in db.StudentTables select new { p.StudentID, p.StudentName,p.Mobile,p.Email };
GridView1.DataSource = query;
GridView1.DataBind();
}
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Oct 18, 2013, 11:42 PM EDT
What is your problem here?
Sanjay KumarRank #561 · 4.3K reputationPosted Oct 19, 2013, 12:05 AM EDT
Sanjay KumarRank #561 · 4.3K reputationPosted Oct 19, 2013, 1:34 AM EDT
{
//code help
}
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Oct 19, 2013, 1:50 AM EDT
Add a overloaded BindGrid function like this,
private void BindGrid(string name)
{
var query = from p in db.StudentTables where p.StudentName.Equals(name) select new { p.StudentID, p.StudentName,p.Mobile,p.Email };
GridView1.DataSource = query;
GridView1.DataBind();
}
call this from click event like,
protected void btnSearch_Click(object sender, EventArgs e)
{
BindGrid(txtSearch.text);
}
Sanjay KumarRank #561 · 4.3K reputationPosted Oct 19, 2013, 3:30 AM EDT
no overload for method arguments