| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 456 人关注过本帖
标题:[求助]小问题啊
取消只看楼主 加入收藏
belin2000
Rank: 3Rank: 3
等 级:论坛游侠
威 望:5
帖 子:975
专家分:194
注 册:2004-6-2
结帖率:0
收藏
 问题点数:0 回复次数:1 
[求助]小问题啊

aspx部分代码:
<asp:Panel ID="Panel2" runat="server" Height="100%" Width="100%">
<div id="div4">
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" CellPadding="4"
ForeColor="#333333" GridLines="None" Height="50px" Width="220px" AutoGenerateEditButton="True" OnModeChanging="DetailsView1_ModeChanging" OnModeChanged="DetailsView1_ModeChanged">
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<CommandRowStyle BackColor="#D1DDF1" Font-Bold="True" />
<EditRowStyle BackColor="#2461BF" />
<RowStyle BackColor="#EFF3FB" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<Fields>
<asp:TemplateField HeaderText="所属ID" SortExpression="bbc_0">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("bbc_0") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="版面名称" SortExpression="bbc_1">
<EditItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("bbc_1") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("bbc_1") %>'></asp:TextBox>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("bbc_1") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="分类">
<EditItemTemplate><asp:DropDownList ID="DropDownList2" runat="server">
</asp:DropDownList>
</EditItemTemplate>
<InsertItemTemplate>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label3" runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="版面说明" SortExpression="bbc_4">
<EditItemTemplate>
<asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("bbc_4") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("bbc_4") %>'></asp:TextBox>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label4" runat="server" Text='<%# Bind("bbc_4") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="版面版主" SortExpression="bbc_3">
<EditItemTemplate>
<asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("bbc_3") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("bbc_3") %>'></asp:TextBox>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label5" runat="server" Text='<%# Bind("bbc_3") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="访问级别">
<EditItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server">
</asp:DropDownList>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label6" runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Fields>
<FieldHeaderStyle BackColor="#DEE8F5" Font-Bold="True" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:DetailsView>
</div>
</asp:Panel>

cs部分代码
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Panel1.Visible = true;
Panel2.Visible = false;
}
}
点击了某个按钮后
{
Panel1.Visible = false;
Panel2.Visible = true;
DataTable dt = pwebdata.retable("select * ,bst_4.puk_1 as bbc_111 from bst_1 inner join bst_4 on bst_4.puk_0=bst_1.bbc_5 where bbc_0=1");
DetailsView1.DataSource = dt;
DetailsView1.DataBind();
}

现在的问题是 DetailsView1的模式不知道怎样才能转换。。。

代码如下

protected void DetailsView1_ModeChanged(object sender, EventArgs e)
{
Response.Write(DetailsView1.CurrentMode.ToString());
switch (DetailsView1.CurrentMode)
{
case DetailsViewMode.Edit:
Response.Write("edit");
break;
case DetailsViewMode.Insert:
Response.Write("insert");
break;
case DetailsViewMode.ReadOnly:
Response.Write("ReadOnly");
break;

}
}
protected void DetailsView1_ModeChanging(object sender, DetailsViewModeEventArgs e)
{
switch (e.NewMode)
{
case DetailsViewMode.Edit:
break;
case DetailsViewMode.ReadOnly:
break;
}
}

页面没有变化,也就是说是ReadOnly模式,DetailsView1_ModeChanged没有触发.

2006-05-05 01:35
belin2000
Rank: 3Rank: 3
等 级:论坛游侠
威 望:5
帖 子:975
专家分:194
注 册:2004-6-2
收藏
得分:0 

顶一下啊


59ita点com(我就爱TA)
2006-05-08 00:45
快速回复:[求助]小问题啊
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017253 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved