I have two RadGridView in WindowsForms namely radGridView1 and radGridView2.
I have data in radGridView1 and also i need to drag and drop radGridView1 row to radGridView2 wise single row and multi row.
And also no data in radGridView2.
My coding are mentioned below.
private void Form1_Load(object sender, EventArgs e) { DataTable dt = new DataTable(); dt = c.getdata(); radGridView1.DataSource = dt; }public DataTable getdata() { con.Open(); cmd = new SqlCommand("select * from employee", con); sda = new SqlDataAdapter(cmd); sda.Fill(dt); con.Close(); return dt; }
How to implement this?
Thanks in Advance..!
cellInfo.Value = "<html>" + cellInfo.Value.ToString() + "</html>";foreach (KeyValuePair<String, Color> kvp in this._highlightWords){ cellInfo.Value = Regex.Replace(cellInfo.Value.ToString(), kvp.Key, "<span style=" + '"' + "background-color:" + System.Drawing.ColorTranslator.ToHtml(kvp.Value) + '"' + ">" + kvp.Key + "</span>", RegexOptions.IgnoreCase); string[] tmpString = Regex.Split(cellInfo.Value.ToString(), kvp.Key, RegexOptions.IgnoreCase);}byte[] utf8String = Encoding.UTF8.GetBytes(cellInfo.Value.ToString());cellInfo.Value = Encoding.UTF8.GetString(utf8String);I am currently create an web application to load the selected order in the client transaction record by clicking the copy button in the RadGrid. I implement this by getting the id of the order and retrieve the required entity to insert the form.
JS Runtime Error That Microsoft JScript runtime error: 'document.getElementById(...)' is null or not an object By using MVVM Model , I preset the blank row to be null in terms of the mapped fields such as consumer ID , order ID , consumer Name , Price and so on .
The Order Reference Id is named as referenceOrder and retrieve the LoadReference to insert the record
I am currently using C# , Visual Studio 2012.
What I want to ask is there any methodology to check if the row is blank before the copy action being executed ?
The below is my code
protected void grdCustomerReport_ItemCommand(object sender, GridCommandEventArgs e)
{
// [Start] Declare Grid and GridData.
RadGrid CurrentGrid = (RadGrid)sender;
GridDataCustomerReport GridSource = PageSource.GrdCustomerReport;
//[End]
if (e.CommandName == "CustomInsert" &&
GridSource.state != GridModelState.Edit)
{
//Add blank row
}
else if (e.CommandName == "DeleteCurrent")
{
//Delete Row
CurrentGrid.Rebind();
}
else if (e.CommandName == "Copy") <--I click the button and retrieve the dataset index
{
//Check if there is empty row ?
int referenceOrder ;
int rowIndex = Convert.ToInt32(e.CommandArgument);
RadComboBox cbo= (RadComboBox) CurrentGrid.Items[rowIndex].FindControl("cboCode");
if (cbo.SelectedIndex > 0 && cbo.SelectedValue != "")
{
referenceOrder = Convert.ToInt32(cbo.SelectedValue);
PageSource.SetOrder(referenceOrder );
LoadReference();
}
else
{
winAlert.RadAlert("<b>" + "Please Select Reference Orderin the Dropdown List" + "</b>.<br />", 330, 100, "", null);
}
}
}
/// <summary>/// Load on demand drop down list/// </summary>/// <param name="sender"></param>/// <param name="e"></param>/// <remarks></remarks>private void ddlPatient_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e){ //Datasource only changes when user hits a letter //OrElse e.KeyCode = Keys.Return Then if ((e.KeyCode >= Keys.A && e.KeyCode <= Keys.Z)) { //and we have atleast 3 characters if (ddlPatient.Text.Length > 2) { //suspend any further keyboard input, untill we're done ddlPatient.KeyDown += SuspendKeyboard; string txt = ddlPatient.Text; //update de dropdown datasource based on the user input (from Open Access model)
ddlPatient.DataSource = _context.Patients .Where(c => c.Naam.StartsWith(txt) || c.GetrouwdeNaam.StartsWith(txt)) .OrderBy(c => c.Naam)
.ThenByDescending(c => c.GeboorteDatum) .Take(100); //This should be done when initializing the form //ddlPatient.DisplayMember = "InfoZoekPatient" //ddlPatient.ValueMember = "PatientID" //restore the user input and place the cursor at the and of the text ddlPatient.Text = txt; ddlPatient.SelectionStart = txt.Length; //restore keyboard input ddlPatient.KeyDown -= SuspendKeyboard; } e.Handled = true; e.SuppressKeyPress = true; } }/// <summary>/// Catch any keyboard input and ignore it!/// </summary>/// <param name="sender"></param>/// <param name="e"></param>/// <remarks></remarks>private void SuspendKeyboard(object sender, KeyEventArgs e){ e.Handled = true; e.SuppressKeyPress = true;}/// <summary>/// When a patient was not selected, but the user enter a search string we need to clean up./// </summary>/// <param name="sender"></param>/// <param name="e"></param>/// <remarks></remarks>private void ddlPatient_Leave(object sender, System.EventArgs e){ RadDropDownList ddl = sender; bool clear = true; //check if the selected item valuemember equals the ddl text. if (ddl.SelectedItem != null) { Patient pat = ddl.SelectedItem.DataBoundItem; if (pat != null) { if (ddl.Text.Trim == pat.InfoZoekPatient.Trim) clear = false; } } if (clear) { ddl.SelectedIndex = -1; ddl.Text = string.Empty; ddl.SelectedItem = null; ddl.Update(); }}for each (Windows::Forms::DataGridViewColumn^ column in dgv->Columns){ if(column->HeaderText == "Something")) { for each (DataGridViewRow^ row in dgv->Rows) { row->Cells[column->Index] = gcnew DataGridViewLinkCell(); } }}This takes the ease out of setting and forgetting, but I couldn't figure out an alternate way.