Jim2Yoo

导航

公告

统计

2006年7月26日 #

asp.net 2.0 中如何让membership接口使用自定义数据库。

asp.net 2.包含了一组membership的控件,使用起来很方便,但是我们一般通过asp.net 的配置工具来启用membership,这个工具默认生成aspnet.mdf,如果我们让它使用我们已有的数据库,那么,你只要将C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\Machine.config里面的部分配置copy到web.config再稍做修改就可以了。修改后,配置工具就会把那些表生成在你指定的数据库里面了。

posted @ 2006-07-26 17:31 Jimmy.Yu 阅读(460) 评论(1) 编辑

在asp.net 2.0的detailview中使用dropdownlist控件

 <asp:TemplateField HeaderText="priority" SortExpression="priority">
                                    
<EditItemTemplate>
                                        
<asp:DropDownList ID="DropDownList3" runat="server">
                                            
<asp:ListItem Value="4">AA</asp:ListItem>
                                            
<asp:ListItem Value="3">A</asp:ListItem>
                                            
<asp:ListItem Value="2">B</asp:ListItem>
                                            
<asp:ListItem Value="1">C</asp:ListItem>
                                        
</asp:DropDownList>
                                    
</EditItemTemplate>
                                    
<InsertItemTemplate>
                                        
<asp:DropDownList ID="DropDownList3" runat="server" SelectedValue='<%# Bind("priority") %>'>
                                            
<asp:ListItem Value="4">AA</asp:ListItem>
                                            
<asp:ListItem Value="3">A</asp:ListItem>
                                            
<asp:ListItem Value="2">B</asp:ListItem>
                                            
<asp:ListItem Value="1">C</asp:ListItem>
                                        
</asp:DropDownList>
                                    
</InsertItemTemplate>
                                    
<ItemTemplate>
                                        
<asp:Label ID="Label2" runat="server" Text='<%# Bind("priority") %>'></asp:Label>
                                    
</ItemTemplate>
                                
</asp:TemplateField>

对于detailview,我们可以实现view,update,insert,如果不用模版,默认是按照数据类型来生成update和insert时候的用户界面,一般就是text和checkbox,如果我们需要使用dropdownlist,那就要自己编辑里面的模版,典型代码都在上面,这里不罗唆了,有一个地方要注意,就是<asp:DropDownList ID="DropDownList3" runat="server" SelectedValue='<%# Bind("priority") %>'>这一行中的SelectedValue='<%# Bind("priority") %>'
如果不写,那么提交的时候这个控件的值是不会保存的,具体原因我也不知道,查了半天国外的网站找到的。这里贴出来给有同样问题的朋友共享。

posted @ 2006-07-26 17:22 Jimmy.Yu 阅读(551) 评论(0) 编辑