DropDownList in DetailsView

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vineetbindal
    New Member
    • Jan 2009
    • 57

    DropDownList in DetailsView

    Hi,

    I have a detailsview with

    AutoGenerateDel eteButton="True "
    AutoGenerateEdi tButton="True"
    AutoGenerateIns ertButton="True "

    and dropdownlist in all the rows in

    <EditItemTempla te><here></EditItemTemplat e>

    DefoultView of detailsview is ReadOnly, i want that when user clicks edit dropdowns should be visible and then user can click update value in order to update those values.


    i donno how to do it. msdn says when we will click edit by defoult text boxes will be displayed.

    can someone give me someexample or idea about how to do it.
  • sangam56
    New Member
    • Nov 2007
    • 68

    #2
    Hi , Vineetbandal,
    You are right in the position. Go straight ahead. If you have edititemtemplat e and you place dropdownlists there they will sure show in the edit mode. Only thing you need is populate your dropdownlist. This can be done in the design time or programmaticall y later. Cheers.

    Comment

    • vineetbindal
      New Member
      • Jan 2009
      • 57

      #3
      Hi,


      But something is wrong there.. when i click on edit... it just desplayes me
      EmptyDataText=" There are no records."...

      i dont understant why???

      Comment

      • vineetbindal
        New Member
        • Jan 2009
        • 57

        #4
        this is my detailsview ..
        Code:
        <asp:DetailsView  Runat="Server" ID="DetailsView1" FieldHeaderStyle-Font-Bold="true"
                FieldHeaderStyle-HorizontalAlign="Right" 
                                AutoGenerateDeleteButton="True" AutoGenerateEditButton="True" 
                                AutoGenerateInsertButton="True" AutoGenerateRows="False" BorderStyle="None" 
                                BorderWidth="1px" CaptionAlign="Left" CellPadding="3" CssClass="Normal" DefaultMode="ReadOnly"
                                 EmptyDataText="There are no records." Visible="False"> 
              
        <FieldHeaderStyle HorizontalAlign="Right" Font-Bold="True" ></FieldHeaderStyle>
                <Fields>
                
               
            <asp:TemplateField HeaderText="UserLevel">
           
                                <ItemTemplate>
                                <asp:Label ID="lblUser" runat="server" Text='<%# Bind("UserLevel") %>'></asp:Label>
                   </ItemTemplate>
                   <EditItemTemplate><asp:DropDownList ID="DDL1" runat="server" DataSourceID="UserLevelDataSource" 
                    DataTextField="UserLevelDesc" DataValueField="UserLevelID"></asp:DropDownList>
                <asp:ObjectDataSource ID="UserLevelDataSource" runat="server" 
                    SelectMethod="AdminUserLevelList" TypeName="bpDevDataClassesDataContext">
                </asp:ObjectDataSource>
            
                   </EditItemTemplate>
                   </asp:TemplateField> 
            
            <asp:TemplateField HeaderText="Status">
            <ItemTemplate>
            <asp:Label ID="lblStatus" runat="server"></asp:Label>
            </ItemTemplate>
            <EditItemTemplate></EditItemTemplate>
            </asp:TemplateField> 
            
            <asp:TemplateField HeaderText="ActionLevel">
            <ItemTemplate>
            <asp:Label ID="lblAction" runat="server" Text='<%# Bind("ActionLevel") %>'></asp:Label>
            </ItemTemplate>
            <EditItemTemplate></EditItemTemplate>
            </asp:TemplateField> 
            
            <asp:TemplateField HeaderText="TypeLevel">
           
            <ItemTemplate>
            <asp:Label ID="lblType" runat="server" Text='<%# Bind("TypeLevel") %>'></asp:Label>
            </ItemTemplate>
            <EditItemTemplate></EditItemTemplate>
            </asp:TemplateField>    
                
                </Fields>
            </asp:DetailsView>
        Last edited by Frinavale; Feb 4 '09, 07:46 PM. Reason: changed quote tags into [code] tags

        Comment

        Working...