Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8956795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:51:17+00:00 2026-06-15T14:51:17+00:00

I had created a datagridview like this public void gridviewsetup() { tbl_Aplication.Columns.Add(1, Empid); tbl_Aplication.Columns.Add(2,

  • 0

I had created a datagridview like this

public void gridviewsetup()
    {
      tbl_Aplication.Columns.Add("1", "Empid");
        tbl_Aplication.Columns.Add("2", "Emp no");
        tbl_Aplication.Columns.Add("3", "Emp Name");
        tbl_Aplication.Columns.Add("4", "Department ");
        tbl_Aplication.Columns.Add("5", "Designation");
        tbl_Aplication.Columns.Add("6", "Shift");
        tbl_Aplication.Columns.Add("7", "Start Time");
        tbl_Aplication.Columns.Add("8", "End Time");
        tbl_Aplication.Columns.Add("9", "OT");
        tbl_Aplication.Columns.Add("10", "Reversed Swipe Out");            
        tbl_Aplication.RowTemplate.Height = 18;            
    }

and i had populated a data table to fill the data dgridview

 public void filldatagrid()
    {
        if (cmb_dept.Text.Trim() != "")
        {



Datatable employedata = empreg.getallemployeeshiftdetails(int.Parse(cmb_dept.SelectedValue.ToString()), Program.LOCTNPK);

          tbl_Aplication.Rows.Clear();
        tbl_Aplication.DataSource = null;
        for (int i = 0; i < employedata.Rows.Count; i++)
        {

            tbl_Aplication.Rows.Add();
            tbl_Aplication.Rows[i].Cells[1].Value = employedata.Rows[i][0];

            tbl_Aplication.Rows[i].Cells[2].Value = employedata.Rows[i][1];
            tbl_Aplication.Rows[i].Cells[3].Value = employedata.Rows[i][2];
            tbl_Aplication.Rows[i].Cells[4].Value = employedata.Rows[i][3];
            tbl_Aplication.Rows[i].Cells[5].Value = employedata.Rows[i][4];
            tbl_Aplication.Rows[i].Cells[6].Value = employedata.Rows[i][5];
            tbl_Aplication.Rows[i].Cells[7].Value = employedata.Rows[i][6];   
            tbl_Aplication.Rows[i].Cells[8].Value = employedata.Rows[i][7];
            tbl_Aplication.Rows[i].Cells[9].Value = 0;
            tbl_Aplication.Rows[i].Cells[10].Value = employedata.Rows[i][7];           


        }
    }

}

now i want to filter data in the datagrid with the designation selected in the combobox without going back to database ,I did it like this but it shows error

   private void cmb_designation_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (desgflag != 0)
        {
            if (cmb_dept.SelectedValue!=null )
            {

           // tbl_Aplication.DataSource = employedata;
                ((DataTable)tbl_Aplication.DataSource).DefaultView.RowFilter = " designationnName like '%" + cmb_dept.Text.Trim() + "%' ";
         }
        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T14:51:18+00:00Added an answer on June 15, 2026 at 2:51 pm

    I had done it

    private void cmb_department_SelectedIndexChanged(object sender, EventArgs e)
            {
    
                try
                {
                    if (cmb_department.Text.Trim() == "" || cmb_department.Text.Trim() == null)
                    {
    
                        tbl_DestinationData.DataSource = dt;
                    }
    
                    else
                    {
                        ((DataTable)tbl_DestinationData.DataSource).DefaultView.RowFilter = " Dept like '%" + cmb_department.Text.Trim() + "%' ";
    
                    }
    
    
    
                }
                catch (Exception )
                {
                    throw;
                }
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a DataGridView that uses databinding, with manually created columns, and this works
I had created one HTML page for my experiance. In this i had use
This is what I want: I had created the top red layout by this
I had created a base class that has many public properties and were been
I had created a comment app with custom field like parentId and email_notification. In
To implement this feature I had created a a column replyTo which relates to
I had created this method to check number of this record in the table
I had created one div window which is draggable,and created one child div (with
I had created the following view, SELECT currency_cd, SUM(comprate) AS salary, employee_code, (SELECT SUM(c.comprate)
I had created a Lib Project with a class inherits ServiceBase but when I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.