problem with edit data

Discussion in 'ASP.NET / ASP.NET Core' started by cool_man77, Nov 20, 2003.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I have one big trouble in write aspx. I 'm writing a page for user edit database, i used datagrid with Editing Capability. My database structure:

    CountyID Name
    1 Adfsdf
    2 Sdfvdf
    3 Escvc
    4 Dsdfn

    DistrictID Name CountyID
    1 Dist 1 1
    2 Dist 2 2
    3 Dist 3 3

    My page for user change data in District table. I had write:

    <asp:datagrid ID="objDataGird" runat="server" HeaderStyle-Font-Bold="true" AutoGenerateColumns="false" AllowPaging="true" PageSize="4" PagerStyle-HorizontalAlign="center" OnPageIndexChanged="doPaging" PagerStyle-Mode="NumericPages" OnEditCommand="objDataGird_Edit" OnCancelCommand="objDataGird_Cancel" OnUpdateCommand="objDataGird_Update" DataKeyField="DistrictID" AllowSorting="true" OnSortCommand="sortGrid">
    <Columns>
    <asp:editcommandcolumn EditText="Edit" CancelText="Cancel" UpdateText="Update" ItemStyle-Wrap="false"/>
    <asp:BoundColumn DataField="DistrictID" HeaderText="ID" ReadOnly="true" SortExpression="DistrictID"/>
    <asp:TemplateColumn HeaderText="Name" SortExpression="Name">
    <ItemTemplate>
    <asp:label Text=<%# FormatBlankAsNone(Container.DataItem("Name"))%> runat="server"></asp:label>
    </ItemTemplate>
    <editItemTemplate><asp:textbox ID="Name" Text=<%# Container.DataItem("Name"))%> TextMode="SingleLine" runat="server"/>
    </editItemTemplate>
    </asp:TemplateColumn>

    <asp:TemplateColumn HeaderText="CountyID" SortExpression="CountyID">
    <ItemTemplate>
    <asp:label Text=<%# Container.DataItem("CountyID")%> runat="server"/>
    </ItemTemplate>
    <editItemTemplate>

    '=============================================================
    'BUT IN HERE I WANT TO SHOW A DROPDOWNLIST WITH SELECT ALL FIELD FROM COUNTY TABLE FOR USER CHOOSE ONE VALUE</font id="red">
    <asp:textbox ID="CountyID" Text=<%# Container.DataItem("CountyID"))%> TextMode="SingleLine" runat="server"/>
    '=============================================================

    </editItemTemplate>
    </asp:TemplateColumn>


    </Columns>
    </asp:datagrid>

    How can i do that? Pls, anyone had experience with this case, help me...thanks
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page