在手风琴内部添加动态网格 [英] Adding dynamic grid inside accordion

查看:79
本文介绍了在手风琴内部添加动态网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我想在手风琴面板中添加动态网格.
我真正想要的是,当有人登陆我的页面时,我的手风琴中有一些窗格,每个窗格由从数据库填充的1个网格组成,当用户单击添加"按钮时,会弹出一个对话框,询问新部分的名称,等等.使用时,添加此新部分时,将在手风琴中添加带有网格的新窗格以及用户定义的值.

Hello everyone,
I want to add dynamic grid inside accordion panel.
What i actually want is, when someone lands of my page there is some panes in my accordion, each panes consists of 1 grid populated from databse, when the user clicks on add button, a popup opes asking for name etc for the new section and when used added this new section, new pane with a grid gets added with the user defined values in the accordion.
Can anyone experienced help me with this?

推荐答案



从CodeBehind中,您需要创建GridView对象,然后使用
将其添加到Panel中.
Hi,

from CodeBehind you need to create GridView object and add it into Panel using

GridView grid1 = new GridView();
grid1.DataSource = ds; // here ds will be comming from database.
Panel1.Controls.Add(grid1);



希望这对您有用,

谢谢
-amit.



hope this may work for you,

thanks
-amit.


检查此博客
http://forums.asp.net/t/1448054.aspx [
check this blog
http://forums.asp.net/t/1448054.aspx[^]
--NDK


好的,
这是我背后的代码

Sure,
this is my code behind

 GridView gv = new GridView();
            gv.DataSource = ds.Tables[0];
            gv.DataBind();
           
            foreach (DataRow dtrow in ds.Tables[0].Rows)
            {
                UserControl usrCtrl = new UserControl();                
                AjaxControlToolkit.AccordionPane panes = new AjaxControlToolkit.AccordionPane();
                //panes.ID = "Section" + i;
                panes.ID = dtrow[0].ToString();
                panes.CssClass = "contentAccordion";
                panes.HeaderContainer.Controls.Add(gv);
panes.ContentContainer.Controls.Add(gv);
panes.ContentContainer.Controls.Add(gv);
                acDummy.Panes.Add(panes);
            }



上面的代码仅供测试.
问题是它只是在手风琴中显示1个面板,尽管我在contentcontainer中添加了多个控件,在headercontrol中添加了1个控件



Above code is just for testing.
The problem is its just showing 1 panel in the accordion though i have added multiple controls in the contentcontainer and 1 control in the headercontrol


这篇关于在手风琴内部添加动态网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆