DevExpress GridControl, How to change Cell value via EditForm but Editor is NOT focus












0















I have 2 editor in custom EditForm, when editor1 text change, editor2 text property is assign same value.
the code handled textbox1.TextChanged event.
When textBox1.Text change, the textbox2.Text display are changed, but when textBox2 get foucs, the text are disappear.
How to change Cell value via EditForm but Editor is NOT focus, or when I change textBox2 display value, how to post to my gridRow.



public partial class Form1 :Form {
public Form1() {
InitializeComponent();

GridControl gridControl = new GridControl();
GridView gridView = new GridView();
gridControl.MainView = gridView;
gridControl.Dock = DockStyle.Fill;
gridControl.Parent = this;

DataTable table = new DataTable();
table.Columns.Add("FirstName", typeof(string));
table.Columns.Add("LastNmae", typeof(string));

gridControl.DataSource = table;

gridView.OptionsView.NewItemRowPosition = NewItemRowPosition.Bottom;
gridView.OptionsBehavior.EditingMode = GridEditingMode.EditFormInplace;
gridView.OptionsEditForm.CustomEditFormLayout = new CustomEditForm();

Controls.Add(gridControl);
}
}

public class CustomEditForm : EditFormUserControl
{
public CustomEditForm()
{
InitializeComponent();

TextBox textBox1 = new TextBox();
textBox1.Location = new System.Drawing.Point(26, 17);
textBox1.Size = new System.Drawing.Size(100, 22);
textBox1.TabIndex = 0;
this.Controls.Add(textBox1);


TextBox textBox2 = new TextBox();
textBox2.Location = new System.Drawing.Point(26, 47);
textBox2.Size = new System.Drawing.Size(100, 22);
textBox2.TabIndex = 0;
this.Controls.Add(textBox2);

this.SetBoundFieldName(textBox1, "FirstName");
this.SetBoundFieldName(textBox2, "LastName");

textBox1.TextChanged += (s, e) =>
{
textBox2.Text = (s as TextBox).Text;
};
}

private void InitializeComponent()
{
SuspendLayout();

this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Name = "Editor";
this.Size = new System.Drawing.Size(230, 148);
this.ResumeLayout(false);
this.PerformLayout();
}
}









share|improve this question


















  • 1





    ok in general terms its best to approach this by changing the data that the grid is bound to then do a refresh of the grid data source binding.

    – JohnB
    Nov 16 '18 at 3:43
















0















I have 2 editor in custom EditForm, when editor1 text change, editor2 text property is assign same value.
the code handled textbox1.TextChanged event.
When textBox1.Text change, the textbox2.Text display are changed, but when textBox2 get foucs, the text are disappear.
How to change Cell value via EditForm but Editor is NOT focus, or when I change textBox2 display value, how to post to my gridRow.



public partial class Form1 :Form {
public Form1() {
InitializeComponent();

GridControl gridControl = new GridControl();
GridView gridView = new GridView();
gridControl.MainView = gridView;
gridControl.Dock = DockStyle.Fill;
gridControl.Parent = this;

DataTable table = new DataTable();
table.Columns.Add("FirstName", typeof(string));
table.Columns.Add("LastNmae", typeof(string));

gridControl.DataSource = table;

gridView.OptionsView.NewItemRowPosition = NewItemRowPosition.Bottom;
gridView.OptionsBehavior.EditingMode = GridEditingMode.EditFormInplace;
gridView.OptionsEditForm.CustomEditFormLayout = new CustomEditForm();

Controls.Add(gridControl);
}
}

public class CustomEditForm : EditFormUserControl
{
public CustomEditForm()
{
InitializeComponent();

TextBox textBox1 = new TextBox();
textBox1.Location = new System.Drawing.Point(26, 17);
textBox1.Size = new System.Drawing.Size(100, 22);
textBox1.TabIndex = 0;
this.Controls.Add(textBox1);


TextBox textBox2 = new TextBox();
textBox2.Location = new System.Drawing.Point(26, 47);
textBox2.Size = new System.Drawing.Size(100, 22);
textBox2.TabIndex = 0;
this.Controls.Add(textBox2);

this.SetBoundFieldName(textBox1, "FirstName");
this.SetBoundFieldName(textBox2, "LastName");

textBox1.TextChanged += (s, e) =>
{
textBox2.Text = (s as TextBox).Text;
};
}

private void InitializeComponent()
{
SuspendLayout();

this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Name = "Editor";
this.Size = new System.Drawing.Size(230, 148);
this.ResumeLayout(false);
this.PerformLayout();
}
}









share|improve this question


















  • 1





    ok in general terms its best to approach this by changing the data that the grid is bound to then do a refresh of the grid data source binding.

    – JohnB
    Nov 16 '18 at 3:43














0












0








0








I have 2 editor in custom EditForm, when editor1 text change, editor2 text property is assign same value.
the code handled textbox1.TextChanged event.
When textBox1.Text change, the textbox2.Text display are changed, but when textBox2 get foucs, the text are disappear.
How to change Cell value via EditForm but Editor is NOT focus, or when I change textBox2 display value, how to post to my gridRow.



public partial class Form1 :Form {
public Form1() {
InitializeComponent();

GridControl gridControl = new GridControl();
GridView gridView = new GridView();
gridControl.MainView = gridView;
gridControl.Dock = DockStyle.Fill;
gridControl.Parent = this;

DataTable table = new DataTable();
table.Columns.Add("FirstName", typeof(string));
table.Columns.Add("LastNmae", typeof(string));

gridControl.DataSource = table;

gridView.OptionsView.NewItemRowPosition = NewItemRowPosition.Bottom;
gridView.OptionsBehavior.EditingMode = GridEditingMode.EditFormInplace;
gridView.OptionsEditForm.CustomEditFormLayout = new CustomEditForm();

Controls.Add(gridControl);
}
}

public class CustomEditForm : EditFormUserControl
{
public CustomEditForm()
{
InitializeComponent();

TextBox textBox1 = new TextBox();
textBox1.Location = new System.Drawing.Point(26, 17);
textBox1.Size = new System.Drawing.Size(100, 22);
textBox1.TabIndex = 0;
this.Controls.Add(textBox1);


TextBox textBox2 = new TextBox();
textBox2.Location = new System.Drawing.Point(26, 47);
textBox2.Size = new System.Drawing.Size(100, 22);
textBox2.TabIndex = 0;
this.Controls.Add(textBox2);

this.SetBoundFieldName(textBox1, "FirstName");
this.SetBoundFieldName(textBox2, "LastName");

textBox1.TextChanged += (s, e) =>
{
textBox2.Text = (s as TextBox).Text;
};
}

private void InitializeComponent()
{
SuspendLayout();

this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Name = "Editor";
this.Size = new System.Drawing.Size(230, 148);
this.ResumeLayout(false);
this.PerformLayout();
}
}









share|improve this question














I have 2 editor in custom EditForm, when editor1 text change, editor2 text property is assign same value.
the code handled textbox1.TextChanged event.
When textBox1.Text change, the textbox2.Text display are changed, but when textBox2 get foucs, the text are disappear.
How to change Cell value via EditForm but Editor is NOT focus, or when I change textBox2 display value, how to post to my gridRow.



public partial class Form1 :Form {
public Form1() {
InitializeComponent();

GridControl gridControl = new GridControl();
GridView gridView = new GridView();
gridControl.MainView = gridView;
gridControl.Dock = DockStyle.Fill;
gridControl.Parent = this;

DataTable table = new DataTable();
table.Columns.Add("FirstName", typeof(string));
table.Columns.Add("LastNmae", typeof(string));

gridControl.DataSource = table;

gridView.OptionsView.NewItemRowPosition = NewItemRowPosition.Bottom;
gridView.OptionsBehavior.EditingMode = GridEditingMode.EditFormInplace;
gridView.OptionsEditForm.CustomEditFormLayout = new CustomEditForm();

Controls.Add(gridControl);
}
}

public class CustomEditForm : EditFormUserControl
{
public CustomEditForm()
{
InitializeComponent();

TextBox textBox1 = new TextBox();
textBox1.Location = new System.Drawing.Point(26, 17);
textBox1.Size = new System.Drawing.Size(100, 22);
textBox1.TabIndex = 0;
this.Controls.Add(textBox1);


TextBox textBox2 = new TextBox();
textBox2.Location = new System.Drawing.Point(26, 47);
textBox2.Size = new System.Drawing.Size(100, 22);
textBox2.TabIndex = 0;
this.Controls.Add(textBox2);

this.SetBoundFieldName(textBox1, "FirstName");
this.SetBoundFieldName(textBox2, "LastName");

textBox1.TextChanged += (s, e) =>
{
textBox2.Text = (s as TextBox).Text;
};
}

private void InitializeComponent()
{
SuspendLayout();

this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Name = "Editor";
this.Size = new System.Drawing.Size(230, 148);
this.ResumeLayout(false);
this.PerformLayout();
}
}






c# devexpress gridcontrol






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 16 '18 at 3:38









yaowzyaowz

133




133








  • 1





    ok in general terms its best to approach this by changing the data that the grid is bound to then do a refresh of the grid data source binding.

    – JohnB
    Nov 16 '18 at 3:43














  • 1





    ok in general terms its best to approach this by changing the data that the grid is bound to then do a refresh of the grid data source binding.

    – JohnB
    Nov 16 '18 at 3:43








1




1





ok in general terms its best to approach this by changing the data that the grid is bound to then do a refresh of the grid data source binding.

– JohnB
Nov 16 '18 at 3:43





ok in general terms its best to approach this by changing the data that the grid is bound to then do a refresh of the grid data source binding.

– JohnB
Nov 16 '18 at 3:43












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53331073%2fdevexpress-gridcontrol-how-to-change-cell-value-via-editform-but-editor-is-not%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53331073%2fdevexpress-gridcontrol-how-to-change-cell-value-via-editform-but-editor-is-not%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Bressuire

Vorschmack

Quarantine