Hi........
I have one application in that app i have dropdownlists,text boxes,...etc
i want to search in gridview data.when i entered texboxes text and at the same time i selected dropdownlist then at a time search for two r more controls when i click search button.
i m using MySql database.
how i can search please give me any idea.
Loading

Posted May 18, 2011, 6:02 AM
If it is yest, then you can not access the control like the way you're doing. You have iterate the gridviewrow then do the findcontrol then only you can get the control values.
foreach (GridViewRow row in GridView1.Rows)
{
// Selects the text from the TextBox
// which is inside the GridView control
string textBoxText = _
((TextBox)row.FindControl("TextBox1")).Text;
Response.Write(textBoxText);
// Selects the text from the DropDownList
// which is inside the GridView control
string dropDownListText = ((DropDownList)
row.FindControl("DropDownList1")).SelectedItem.Value;
Response.Write(dropDownListText);
}
Posted May 18, 2011, 6:02 AM
If it is yest, then you can not access the control like the way you're doing. You have iterate the gridviewrow then do the findcontrol then only you can get the control values.
Venkat SPosted May 18, 2011, 5:26 AM
MySqlConnection cn = new MySqlConnection(con);
cn.Open();
string str1 = "select rec_name ,cand_name ,clit_name,type ,sub_skillset ,sub_status ,resume_path,sub_comment from add_submission where clit_name LIKE '" + ddlclient.SelectedValue.ToString() + "'";
if (!string.IsNullOrEmpty(txtAuditorName.Text.Trim()))
{
str1 += " and AuditorName like '%" + txtAuditorName.Text.Trim() + "%'";
}
if (cmbs_auditortype.SelectedIndex != 0 && cmbs_auditortype.SelectedIndex != -1)
{
string auditortype = cmbs_auditortype.Text.ToString();
str1 += " and AuditorType='" + auditortype.ToString() + "'";
}
MySqlDataAdapter da = new MySqlDataAdapter(str1, cn);
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
cn.Close();
the above color only the problem.
is it posible to search both database and grid.
any idea tell me how.
Thanks,
Venkat.S
Posted May 18, 2011, 5:05 AM
Can you please post the code?