0



I am currently tasked to do a SQL database with web interface. I am using the Microsoft Visual Web Developer 2010 Express to develop the prototype.

My question is, using the detailsview to edit the user information, how do I make the editable text box to be extended to the end of the table? If possible, the text box can extend downwards with excess text wrapped.

The picture here shows my current output.



Here is my code...

<%@ Page Title="Display Staff Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="DisplayStaff.aspx.cs" Inherits="ASCBioData.About" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <h2>
        Display Staff Biography
    </h2>
    <p>
        Staff:
        <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" 
            DataSourceID="ObjectDataSource1" DataTextField="Name" DataValueField="ID">
        </asp:DropDownList>
        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
            InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" 
            SelectMethod="GetData" 
            TypeName="ASCBioData.Data.StaffDataTableAdapters.ASCBioDataTableAdapter">
            <InsertParameters>
                <asp:Parameter Name="Name" Type="String" />
                <asp:Parameter Name="Education" Type="String" />
                <asp:Parameter Name="BIO" Type="String" />
                <asp:Parameter Name="Highlights" Type="String" />
            </InsertParameters>
        </asp:ObjectDataSource>
        <asp:DetailsView ID="StaffTable" runat="server" AutoGenerateRows="False" 
            CellPadding="10" DataSourceID="ObjectDataSource2" ForeColor="#333333" 
            GridLines="None" Height="50px" Width="916px">
            <AlternatingRowStyle BackColor="White" />
            <CommandRowStyle BackColor="#C5BBAF" Font-Bold="True" HorizontalAlign="Right" />
            <EditRowStyle BackColor="#8E8064" Wrap="True" />
            <FieldHeaderStyle BackColor="#D0D0D0" Font-Bold="True" VerticalAlign="Top" 
                Width="70px" />
            <Fields>
                <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" 
                    ReadOnly="True" SortExpression="ID" Visible="False" />
                <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                <asp:BoundField DataField="Education" HeaderText="Education" 
                    SortExpression="Education" />
                <asp:BoundField DataField="BIO" HeaderText="BIO" SortExpression="BIO" />
                <asp:BoundField DataField="Highlights" HeaderText="Highlights" 
                    SortExpression="Highlights" />
                <asp:CommandField ShowEditButton="True" />
            </Fields>
            <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
            <InsertRowStyle Height="300px" />
            <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#E3EAEB" />
        </asp:DetailsView>
        <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" 
            InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" 
            SelectMethod="GetDataByID" 
            TypeName="ASCBioData.Data.StaffDataTableAdapters.ASCBioDataTableAdapter" 
            UpdateMethod="UpdateStaffData">
            <InsertParameters>
                <asp:Parameter Name="Name" Type="String" />
                <asp:Parameter Name="Education" Type="String" />
                <asp:Parameter Name="BIO" Type="String" />
                <asp:Parameter Name="Highlights" Type="String" />
            </InsertParameters>
            <SelectParameters>
                <asp:ControlParameter ControlID="DropDownList1" Name="IsID" 
                    PropertyName="SelectedValue" Type="Int32" />
            </SelectParameters>
            <UpdateParameters>
                <asp:Parameter Name="original_ID" Type="Int32" />
                <asp:Parameter Name="Name" Type="String" />
                <asp:Parameter Name="Education" Type="String" />
                <asp:Parameter Name="BIO" Type="String" />
                <asp:Parameter Name="Highlights" Type="String" />
            </UpdateParameters>
        </asp:ObjectDataSource>
    </p>
</asp:Content>

Please advise and thanks in advance...

1 Answer 1

0

you can use <asp:TemplateField /> then inside you can use <asp:TextBox /> and set TextMode="MultiLine". So something like

<asp:TemplateField>
<ItemTemplate>
<%# Eval("Highlights") %>
</ItemTemplate>
<EditItemTemplate>
    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Eval("Highlights") %>'
        TextMode="MultiLine"></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>

This is on top of my head so do test the syntax.. but it should give you what you're looking for.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.