开发者

How to Add Gridviews Dynamically to a page depending on variable count

Good morning.

Situation: I have department table and in each department I have some parameter types. lets say Dept1 has param1,param2 and Dept2 has param1,param2 and param3

This parameters count varies from department to department.

I have to design a page for each department in that page we have individual tabs for each parameter. So here what I need is adding a Gridview for each parameter type under each tab.

Can any one suggest how to achieve this. Thanks in a开发者_JS百科dvance.


First do a change in your Sp .. Check max number of counts params that any department has.. Now all department will take columns equivalent to max number of params that a department have but having null values.. For Example If dept1 has 2params and dept2 has 3params than the query will result 3 column in case of dept1 also but its param3 column will contain null or zero..

Now after binding grid you will check if it is dept1 grid then you'll hide param3 column..


In database table create those many(in your case it is 6) fields for parameter value storage as param1,param2,.....,param6 and give default value as null. And create 1 more field to save parameters count for that department(this is for your use, based on this count you can easily find out how many parameters that department have).

So while inserting parameters you can insert how many parameters that department have and while showing in UI based on countField you can show the result

any queries add comment

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜