Frage

Have RadGridView which have ImageColumn How To set Default Image For this Column ? i am Using

  private void setImageToColumns()
    {
        foreach (var row in dgv_AddJournal.Rows)
        {
            row.Cells["SearchAccount"].Value = Accounting.Genral.Properties.Resources._1396284460_system_search; 
            row.Cells["SearchCostCenter"].Value = Accounting.Genral.Properties.Resources._1396284460_system_search;
            row.Cells["DeleteAccount"].Value = Accounting.Genral.Properties.Resources._1398281700_Gnome_Edit_Clear_64;
            row.Cells["DeleteCost"].Value = Accounting.Genral.Properties.Resources._1398281700_Gnome_Edit_Clear_64;

        }
    }

and i call this method in PageLoad And UserAddingRow Event and its Working there is a way to set default image without code ?

War es hilfreich?

Lösung 2

i Get My Goal By Adding

dgv_AddJournal.CurrentRow.Cells["SearchAccount"].Value = Accounting.Genral.Properties.Resources._1396284460_system_search; 
            dgv_AddJournal.CurrentRow.Cells["SearchCostCenter"].Value = Accounting.Genral.Properties.Resources._1396284460_system_search;
            dgv_AddJournal.CurrentRow.Cells["DeleteAccount"].Value = Accounting.Genral.Properties.Resources._1398281700_Gnome_Edit_Clear_64;
            dgv_AddJournal.CurrentRow.Cells["DeleteCost"].Value = Accounting.Genral.Properties.Resources._1398281700_Gnome_Edit_Clear_64;

in page load

Andere Tipps

Mohamed Try this in initializing datagrid as you should have two things 1- fake row so you can add on it and customize it and it will be locked 2- Checkup Method so you will Skipping the Empty Row when (Add,edit ,Delete ....etc.)

 private void Exercise_Load(object sender, EventArgs e)

{  

 dgvStudents = new DataGridView();
dgvStudents.Location = new Point(10, 10);
dgvStudents.Size = new Size(645, 100);

DataGridViewTextBoxColumn colFullName = new DataGridViewTextBoxColumn();
dgvStudents.Columns.Add(colFullName);

DataGridViewComboBoxColumn colGender = new DataGridViewComboBoxColumn();
dgvStudents.Columns.Add(colGender);

DataGridViewCheckBoxColumn colShowResume = new DataGridViewCheckBoxColumn();
dgvStudents.Columns.Add(colShowResume);

DataGridViewButtonColumn colShowPicture = new DataGridViewButtonColumn();
dgvStudents.Columns.Add(colShowPicture);

DataGridViewLinkColumn colEmailAddress = new DataGridViewLinkColumn();
dgvStudents.Columns.Add(colEmailAddress);

DataGridViewImageColumn colPicture = new DataGridViewImageColumn();
dgvStudents.Columns.Add(colPicture);

Controls.Add(dgvStudents);
}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top