开发者

About devexpress xtragrid's datasource property

开发者 https://www.devze.com 2023-03-08 19:06 出处:网络
I\'m using DevExpress\'s xtragrid control. In my application I\'m setting the datasource property of gridcontrol at runtime but it not show my updated table value when my form displays.

I'm using DevExpress's xtragrid control. In my application I'm setting the datasource property of gridcontrol at runtime but it not show my updated table value when my form displays.

How to resolve this problem?

I have one main form & other are child ones. I placed my gridview on my child form & which is actually a user control. And in that user control I have my gridview & one bar button item & when I click on button then one form get opened & I fill that form & this information I'm showing on my grid view, it works fine.

And my main form also has one button. When I click on that button then also the same form gets opened & when I fill data in that form then 开发者_开发百科I want to show that information in my grid view which is on the user control for that I used the datasource property as well as refreshdatasource() method of grid control but it not showing the inserted value in my grid view. I created my gridview's columns at run time. What should I do now?

I used event handling for this. My events are declared on the detail form which is opened when i click on bar button item. The event declaration is as follows-

public event DataAddedEventHandler DataAdded;
public delegate void DataAddedEventHandler();

below is event handling function & event registration which is on the usercontrol- ofrmAddContact is the object of my details form.

ofrmAddContact.DataAdded += new frmAddContact.DataAddedEventHandler(AddRow);

private void AddRow()
{
xgBase.DataSource = dbContact.selectAllContacts();
xgBase.RefreshDataSource();
}  

i register event when i click on the bar button item of the user control as well as when i click on the main form button

thanks...


Go to the design view and create columns with proper data member names. Check whether you have given correct data member names.

Here are some examples if you want to have a look.

http://documentation.devexpress.com/#WindowsForms/CustomDocument3000

http://smartbear.com/support/viewarticle/14581/

http://www.devexpress.com/products/net/controls/winforms/grid/


Try to call

  gridControl.RefreshDataSource();


i solved my problem it is happened because of my object of user control

0

精彩评论

暂无评论...
验证码 换一张
取 消