This topic has been archived. It cannot be replied.
-
工作学习 / 学科技术讨论 / 请问做过或者正在做UI的大侠,当需要必须用动态使用templateField的时候,你们是怎么解决TemplateField在GridView里不能保存state的问题的,在Page_Load里每次动态Add/Insert总会自动增加空columns,还要remove这些columns。。。。
-mfcguy();
2008-8-19
{483}
(#4628585@0)
-
你好像没入门,多看看书
-googlebot(bot);
2008-8-19
(#4628599@0)
-
你好像什么也没说,一点诚意也没有。
-kingsw(Steven);
2008-8-19
(#4628606@0)
-
不少IT人就这德行,你过时了,你不行,你水平低,我知道答案就是不告诉你,其实潜台词就是告诉你了我怎么混啊!
-z24(Quick! Do sth. manly);
2008-8-20
(#4629317@0)
-
Not very clear your question. One purpose of ViewState is to keep control’s value to be shown automatically after postback. If it’s your only requirement, you can rebind data source after postback.
-deep_blue(BLUE);
2008-8-20
(#4629903@0)
-
If you have tried dynamically adding TemplateField into GridView control, you would know what I was talking about. check this out.
-mfcguy();
2008-8-20
(#4629944@0)
-
we a using template columns for all columns and works ok. before we add column, we just check if the column count is 0. we save status when postback and set new status in rowdatabound.
-c1xwy(洪兴罩俺去战斗);
2008-8-20
(#4629998@0)
-
that's what I am doing now. we have to delete the empty columns before or after we add/insert TemplateField in every postback. that's painful sometimes.
-mfcguy();
2008-8-22
(#4634396@0)
-
I don’t understand why after postback, it generates a blank column. Since the dynamically added columns are not saved in viewstate, they will disappear after postback. How the blank column comes?BTW, what kind special requirement lets you look for some template other than those built-in GV fields? The HyperLinkField is much more powerful than invented GridViewHyperlinkTemplate
-deep_blue(BLUE);
2008-8-21
{184}
(#4631203@0)
-
It seems you don't have so many experience with GridView control. you probably are back-end developer?
-mfcguy();
2008-8-21
{639}
(#4632662@0)
-
See my comments inside
-deep_blue(BLUE);
2008-8-22
{1354}
(#4633500@0)
-
thanks.
-mfcguy();
2008-8-22
{1113}
(#4633597@0)
-
For question3:I don't think in your code, sometimes you just don't postback enough:)
set a Watch for your gridview.columns.count,you will see everytime you postback the count will increase. because the column we added for TemplateField are still there ,just lost state when posting back. that's why i saw empty columns.
-mfcguy();
2008-8-22
{310}
(#4634415@0)