开发者

WPF: Link from grid to form

What I need is a grid with all employees data, and a link to a single e开发者_运维百科mployees form. I'm ok with filling the grid with data. my questions are: how to create the link? how to send the parameter (employeeid) to the single-employee page, and make it open with the correct data.

Thanks, Ron


The easiest way is to parameterized the constructor of your form that shows single employee records like:

public PageName(int employeeid)
{
    //do your stuff here.. like retrieving to the database the records of the given employeeid and setting the control values, etc.
}

When you create an instance of that form all you need to do is to provide a employeeid of the selected record on the list like:

PageName x = new PageName(value for employeeid);


Try this, it will help. You can use it as a pattern

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜