大家好:
现在请教个问题,就是
我在前台用Datalist嵌套 GridView 实现数据分组显示:
eg:
Group 1 (Group _1 Score)
Item1(dropdownList1,dropdownList2)
Item2(dropdownList1,dropdownList2)
Group 2 (Group _2 Score)
Item1 同上
Item2
Item.n
这些都实现了。如果Item和subItem数据添加和删除的话都能实现现在我要在GridView里实现在客户端的计算 为了直接点,我去掉了一些代码
<asp:DataList ID="DataList1" runat="server" OnPreRender="DataList1_PreRender">
<ItemTemplate>
<table >
<tr>
<td ><asp:Label ID="lblNameDL" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Item")%>'>/asp:Label></td>
<td ><asp:Label ID ="itemScore" runat="server" Text="Socre" /></td>
</tr>
<tr>
<td >
<asp:GridView ID="gvDetailsDL" runat="server" >
<columns>
<asp:TemplateField HeaderText="Item" Visible="False" >
<ItemTemplate>
<asp:Label ID="DLlblItemDetail" runat="server" Text='<%# Bind("Item") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Score(out of 5)">
<ItemTemplate>
<asp:DropDownList id ="DLddlA_Score" runat="server">
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem Selected="True">4</asp:ListItem>
<asp:ListItem>5</asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="ActualWeightage(total is 100)">
<ItemTemplate>
<asp:DropDownList id ="DLddlA_ActualWeightage" runat="server" >
<asp:ListItem>0</asp:ListItem>
<asp:ListItem>5</asp:ListItem>
<asp:ListItem>10</asp:ListItem>
<asp:ListItem Selected="True">15</asp:ListItem>
<asp:ListItem>20</asp:ListItem>
<asp:ListItem>25</asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
</asp:GridView>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
每个Group的score 只计算本组的
最合才计算所有Group的值
计算的规则不用考虑因为Group和item个数不固定,所以当出发GridView里的下拉框时,不知道怎么在客户端去处理,
因为组的个数和组成员的个数都是变动的,所以不知道怎么去处理好,想过用数组来做希望高手们给点意见 谢谢!
现在请教个问题,就是
我在前台用Datalist嵌套 GridView 实现数据分组显示:
eg:
Group 1 (Group _1 Score)
Item1(dropdownList1,dropdownList2)
Item2(dropdownList1,dropdownList2)
Group 2 (Group _2 Score)
Item1 同上
Item2
Item.n
这些都实现了。如果Item和subItem数据添加和删除的话都能实现现在我要在GridView里实现在客户端的计算 为了直接点,我去掉了一些代码
<asp:DataList ID="DataList1" runat="server" OnPreRender="DataList1_PreRender">
<ItemTemplate>
<table >
<tr>
<td ><asp:Label ID="lblNameDL" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Item")%>'>/asp:Label></td>
<td ><asp:Label ID ="itemScore" runat="server" Text="Socre" /></td>
</tr>
<tr>
<td >
<asp:GridView ID="gvDetailsDL" runat="server" >
<columns>
<asp:TemplateField HeaderText="Item" Visible="False" >
<ItemTemplate>
<asp:Label ID="DLlblItemDetail" runat="server" Text='<%# Bind("Item") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Score(out of 5)">
<ItemTemplate>
<asp:DropDownList id ="DLddlA_Score" runat="server">
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem Selected="True">4</asp:ListItem>
<asp:ListItem>5</asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="ActualWeightage(total is 100)">
<ItemTemplate>
<asp:DropDownList id ="DLddlA_ActualWeightage" runat="server" >
<asp:ListItem>0</asp:ListItem>
<asp:ListItem>5</asp:ListItem>
<asp:ListItem>10</asp:ListItem>
<asp:ListItem Selected="True">15</asp:ListItem>
<asp:ListItem>20</asp:ListItem>
<asp:ListItem>25</asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
</asp:GridView>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
每个Group的score 只计算本组的
最合才计算所有Group的值
计算的规则不用考虑因为Group和item个数不固定,所以当出发GridView里的下拉框时,不知道怎么在客户端去处理,
因为组的个数和组成员的个数都是变动的,所以不知道怎么去处理好,想过用数组来做希望高手们给点意见 谢谢!
因为我要在客户端触发下拉框的时候, 去计算当前组的值,但是我要知道当前的组,就是说我要知道上层Datlist中的组名,才能计算所有成员的值
的下拉列表了。
模板页里,为什么生成的html的代码里 没有Datalist的内容呀??
Datalist根本就在HTML源文件看到到踪迹 郁闷