Making ONLY 2 columns editable in a datagrid

Discussion in 'ASP .Net' started by =?Utf-8?B?cG11ZA==?=, Jan 10, 2005.

  1. Hi,
    I have 2 questions:

    1. I have an editable data grid with 21 columns. I need to edit only 2
    cloumns in this data grid. But when the grid is displayed in Edit mode, all
    the columns show long text boxes whichmakes the user to SCROLL a lot.
    I need only these 2 cloumns to be displayed in Edit mode. Is that possible &
    how?

    2. Also, even when the data grid is not displayed in the edit mode, it
    causes a lot of scrolling. Is there some way to avoid this?

    --
    pmud
     
    =?Utf-8?B?cG11ZA==?=, Jan 10, 2005
    #1
    1. Advertising

  2. For the first question, have you tried to hide the column? or only cast two
    columns in which you require Editing?

    For the second question I will suggest using a <div> or <layer> or an
    <iframe>,
    it will make another scrollable window in ur main web page

    "pmud" wrote:

    > Hi,
    > I have 2 questions:
    >
    > 1. I have an editable data grid with 21 columns. I need to edit only 2
    > cloumns in this data grid. But when the grid is displayed in Edit mode, all
    > the columns show long text boxes whichmakes the user to SCROLL a lot.
    > I need only these 2 cloumns to be displayed in Edit mode. Is that possible &
    > how?
    >
    > 2. Also, even when the data grid is not displayed in the edit mode, it
    > causes a lot of scrolling. Is there some way to avoid this?
    >
    > --
    > pmud
     
    =?Utf-8?B?Q2hpbm1heQ==?=, Jan 11, 2005
    #2
    1. Advertising

  3. Hi Chinmay,

    How to cast only 2 cloumns which require editing coz I want to see all the
    columns & then with the click of a button, I am exporting this grid to EXcel.
    So i need to view all the columns when I click EDIT but only 2 columns should
    be displayed in EDIT mode to avoid scrolling.

    Do u think a data grid is appropriate or should I use some other control
    which avoids a lot of scrolling & also allows editing & updating the database
    fileds?

    "Chinmay" wrote:

    > For the first question, have you tried to hide the column? or only cast two
    > columns in which you require Editing?
    >
    > For the second question I will suggest using a <div> or <layer> or an
    > <iframe>,
    > it will make another scrollable window in ur main web page
    >
    > "pmud" wrote:
    >
    > > Hi,
    > > I have 2 questions:
    > >
    > > 1. I have an editable data grid with 21 columns. I need to edit only 2
    > > cloumns in this data grid. But when the grid is displayed in Edit mode, all
    > > the columns show long text boxes whichmakes the user to SCROLL a lot.
    > > I need only these 2 cloumns to be displayed in Edit mode. Is that possible &
    > > how?
    > >
    > > 2. Also, even when the data grid is not displayed in the edit mode, it
    > > causes a lot of scrolling. Is there some way to avoid this?
    > >
    > > --
    > > pmud
     
    =?Utf-8?B?cG11ZA==?=, Jan 11, 2005
    #3
  4. Hi,

    I found out how to make only certain columns in data grid editabel. Its
    simply a matter of going to the Property builder of the data grid --> columns
    & there in Selected columns ...checking the Read only to true for the text
    boxes which you dont want to be edited.

    Its as simple as that. But if you could please tell me how to use <frame >
    tag on a data grid coz <frame > has a SRC property which is set to the web
    page one wants to scroll. But to use it with a data grid? The web page in
    which I have the data grid has another table & a button. When the user clicks
    the button , based on user's input recorrds are displayed in data grid.

    I just want the <frame > tag on the data grid & not on the table. Or if
    anyone has any other ideas to AVOID a lot of scrolling for the user coz my
    DATA GRID has 21 COLUMNS.

    "pmud" wrote:

    > Hi Chinmay,
    >
    > How to cast only 2 cloumns which require editing coz I want to see all the
    > columns & then with the click of a button, I am exporting this grid to EXcel.
    > So i need to view all the columns when I click EDIT but only 2 columns should
    > be displayed in EDIT mode to avoid scrolling.
    >
    > Do u think a data grid is appropriate or should I use some other control
    > which avoids a lot of scrolling & also allows editing & updating the database
    > fileds?
    >
    > "Chinmay" wrote:
    >
    > > For the first question, have you tried to hide the column? or only cast two
    > > columns in which you require Editing?
    > >
    > > For the second question I will suggest using a <div> or <layer> or an
    > > <iframe>,
    > > it will make another scrollable window in ur main web page
    > >
    > > "pmud" wrote:
    > >
    > > > Hi,
    > > > I have 2 questions:
    > > >
    > > > 1. I have an editable data grid with 21 columns. I need to edit only 2
    > > > cloumns in this data grid. But when the grid is displayed in Edit mode, all
    > > > the columns show long text boxes whichmakes the user to SCROLL a lot.
    > > > I need only these 2 cloumns to be displayed in Edit mode. Is that possible &
    > > > how?
    > > >
    > > > 2. Also, even when the data grid is not displayed in the edit mode, it
    > > > causes a lot of scrolling. Is there some way to avoid this?
    > > >
    > > > --
    > > > pmud
     
    =?Utf-8?B?cG11ZA==?=, Jan 11, 2005
    #4
  5. Put this code in the ASPX
    <div id="DGMainHolder" style="Z-INDEX: 1; OVERFLOW: scroll; WIDTH: 755px;
    POSITION: static; HEIGHT: 300px">Your DataGrid Code</div>

    "pmud" wrote:

    > Hi,
    >
    > I found out how to make only certain columns in data grid editabel. Its
    > simply a matter of going to the Property builder of the data grid --> columns
    > & there in Selected columns ...checking the Read only to true for the text
    > boxes which you dont want to be edited.
    >
    > Its as simple as that. But if you could please tell me how to use <frame >
    > tag on a data grid coz <frame > has a SRC property which is set to the web
    > page one wants to scroll. But to use it with a data grid? The web page in
    > which I have the data grid has another table & a button. When the user clicks
    > the button , based on user's input recorrds are displayed in data grid.
    >
    > I just want the <frame > tag on the data grid & not on the table. Or if
    > anyone has any other ideas to AVOID a lot of scrolling for the user coz my
    > DATA GRID has 21 COLUMNS.
    >
    > "pmud" wrote:
    >
    > > Hi Chinmay,
    > >
    > > How to cast only 2 cloumns which require editing coz I want to see all the
    > > columns & then with the click of a button, I am exporting this grid to EXcel.
    > > So i need to view all the columns when I click EDIT but only 2 columns should
    > > be displayed in EDIT mode to avoid scrolling.
    > >
    > > Do u think a data grid is appropriate or should I use some other control
    > > which avoids a lot of scrolling & also allows editing & updating the database
    > > fileds?
    > >
    > > "Chinmay" wrote:
    > >
    > > > For the first question, have you tried to hide the column? or only cast two
    > > > columns in which you require Editing?
    > > >
    > > > For the second question I will suggest using a <div> or <layer> or an
    > > > <iframe>,
    > > > it will make another scrollable window in ur main web page
    > > >
    > > > "pmud" wrote:
    > > >
    > > > > Hi,
    > > > > I have 2 questions:
    > > > >
    > > > > 1. I have an editable data grid with 21 columns. I need to edit only 2
    > > > > cloumns in this data grid. But when the grid is displayed in Edit mode, all
    > > > > the columns show long text boxes whichmakes the user to SCROLL a lot.
    > > > > I need only these 2 cloumns to be displayed in Edit mode. Is that possible &
    > > > > how?
    > > > >
    > > > > 2. Also, even when the data grid is not displayed in the edit mode, it
    > > > > causes a lot of scrolling. Is there some way to avoid this?
    > > > >
    > > > > --
    > > > > pmud
     
    =?Utf-8?B?Q2hpbm1heQ==?=, Jan 12, 2005
    #5
  6. Hi Chinmay,

    I used the <div> tag. But my web page also has a few text boxes & a few
    lables before the data grid. So when I used the <div> tags & scrolled
    vertically, the data grid scrolls up into the text boxes & labels. I want to
    make only the grid vertically scrollable so that it doesnt move inside the
    labels & text boxes on scrolling.

    Any help is appreciated.
    Thanks

    "Chinmay" wrote:

    > Put this code in the ASPX
    > <div id="DGMainHolder" style="Z-INDEX: 1; OVERFLOW: scroll; WIDTH: 755px;
    > POSITION: static; HEIGHT: 300px">Your DataGrid Code</div>
    >
    > "pmud" wrote:
    >
    > > Hi,
    > >
    > > I found out how to make only certain columns in data grid editabel. Its
    > > simply a matter of going to the Property builder of the data grid --> columns
    > > & there in Selected columns ...checking the Read only to true for the text
    > > boxes which you dont want to be edited.
    > >
    > > Its as simple as that. But if you could please tell me how to use <frame >
    > > tag on a data grid coz <frame > has a SRC property which is set to the web
    > > page one wants to scroll. But to use it with a data grid? The web page in
    > > which I have the data grid has another table & a button. When the user clicks
    > > the button , based on user's input recorrds are displayed in data grid.
    > >
    > > I just want the <frame > tag on the data grid & not on the table. Or if
    > > anyone has any other ideas to AVOID a lot of scrolling for the user coz my
    > > DATA GRID has 21 COLUMNS.
    > >
    > > "pmud" wrote:
    > >
    > > > Hi Chinmay,
    > > >
    > > > How to cast only 2 cloumns which require editing coz I want to see all the
    > > > columns & then with the click of a button, I am exporting this grid to EXcel.
    > > > So i need to view all the columns when I click EDIT but only 2 columns should
    > > > be displayed in EDIT mode to avoid scrolling.
    > > >
    > > > Do u think a data grid is appropriate or should I use some other control
    > > > which avoids a lot of scrolling & also allows editing & updating the database
    > > > fileds?
    > > >
    > > > "Chinmay" wrote:
    > > >
    > > > > For the first question, have you tried to hide the column? or only cast two
    > > > > columns in which you require Editing?
    > > > >
    > > > > For the second question I will suggest using a <div> or <layer> or an
    > > > > <iframe>,
    > > > > it will make another scrollable window in ur main web page
    > > > >
    > > > > "pmud" wrote:
    > > > >
    > > > > > Hi,
    > > > > > I have 2 questions:
    > > > > >
    > > > > > 1. I have an editable data grid with 21 columns. I need to edit only 2
    > > > > > cloumns in this data grid. But when the grid is displayed in Edit mode, all
    > > > > > the columns show long text boxes whichmakes the user to SCROLL a lot.
    > > > > > I need only these 2 cloumns to be displayed in Edit mode. Is that possible &
    > > > > > how?
    > > > > >
    > > > > > 2. Also, even when the data grid is not displayed in the edit mode, it
    > > > > > causes a lot of scrolling. Is there some way to avoid this?
    > > > > >
    > > > > > --
    > > > > > pmud
     
    =?Utf-8?B?cG11ZA==?=, Jan 24, 2005
    #6
  7. Well! In this case I suggest you to seperate ur UI in Table Cells.
    See the code
    <table>
    <tr>
    <td>Ur Other Controls</td>
    </tr>
    <tr>
    <td>ur Div and Datagrid</td>
    </tr>
    </table>
     
    =?Utf-8?B?Q2hpbm1heQ==?=, Jan 25, 2005
    #7
  8. Hi Chinmay,

    I tried putting my HTML table(which contains labels & text boxes) & the
    data grid into another table & put the 1st table as a row in the outher table
    & the data grid as one row & buttons & everything as other rows.... But it
    doesnt work... All the controls lay in a haphazard way when I did this...

    I am using the following code. Please tell me what can i do with it so that
    only the data grid is scrollable & not the table above it... I would be
    grateful for ur help.

    HTML Code::

    <body MS_POSITIONING="GridLayout" bgColor="gainsboro">
    <form id="Form1" method="post" runat="server">

    <asp:image id="Image1" style="Z-INDEX: 102; LEFT: 389px; POSITION:
    absolute; TOP: 8px" runat="server" ImageUrl="file:///C:\Documents and
    Settings\user\My Documents\images\a.jpg"></asp:image><asp:label id="Label1"
    style="Z-INDEX: 103; LEFT: 400px; POSITION: absolute; TOP: 119px"
    runat="server"
    Font-Bold="True" Font-Underline="True" Width="96px">VIEW
    LOGS</asp:label><asp:linkbutton id="LinkButton1" style="Z-INDEX: 104; LEFT:
    94px; POSITION: absolute; TOP: 99px"
    runat="server" Width="9px" Height="3px">Home</asp:linkbutton></td>

    <TABLE id="Table1" style="Z-INDEX: 107; LEFT: 303px; WIDTH: 305px;
    POSITION: absolute; TOP: 148px; HEIGHT: 91px"
    cellSpacing="1" cellPadding="1" width="305" border="1">
    <TR>
    <TD style="WIDTH: 126px; HEIGHT: 25px">
    <asp:label id="lblCompany" runat="server" Font-Bold="True"
    Width="117px" Height="5px">Company Name</asp:label></TD>
    <TD style="HEIGHT: 25px">
    <asp:textbox id="txtCompany" runat="server" Width="139px"
    Height="24px"></asp:textbox></TD>
    </TR>
    <TR>
    <TD style="WIDTH: 126px; HEIGHT: 27px">
    <asp:label id="lblMonth" runat="server" Font-Bold="True"
    Width="91px" Height="5px">Month</asp:label></TD>
    <TD style="HEIGHT: 27px">
    <asp:dropdownlist id="ddlMonth" runat="server" Width="115px"
    Height="8px">
    <asp:ListItem Value="None">None</asp:ListItem>
    <asp:ListItem Value="January">January</asp:ListItem>
    <asp:ListItem Value="Feburary">Feburary</asp:ListItem>
    <asp:ListItem Value="March">March</asp:ListItem>
    <asp:ListItem Value="April">April</asp:ListItem>
    <asp:ListItem Value="May">May</asp:ListItem>
    <asp:ListItem Value="June">June</asp:ListItem>
    <asp:ListItem Value="July">July</asp:ListItem>
    <asp:ListItem Value="August">August</asp:ListItem>
    <asp:ListItem Value="September">September</asp:ListItem>
    <asp:ListItem Value="October">October</asp:ListItem>
    <asp:ListItem Value="November">November</asp:ListItem>
    <asp:ListItem Value="December">December</asp:ListItem>
    </asp:dropdownlist></TD>
    </TR>
    <TR>
    <TD style="WIDTH: 126px">
    <asp:label id="Label2" runat="server" Font-Bold="True" Width="5px"
    Height="5px">Year</asp:label></TD>
    <TD>
    <asp:textbox id="txtYear" runat="server" Width="126px"
    Height="25px"></asp:textbox></TD>
    </TR>
    </TABLE>

    <asp:button id="btnSubmit" style="Z-INDEX: 101; LEFT: 397px; POSITION:
    absolute; TOP: 261px"
    runat="server" Text="Submit"></asp:button></td>
    <div id="DGMainHolder"
    style="OVERFLOW:scroll;WIDTH:960px;HEIGHT:900px"><asp:datagrid id=DataGrid1
    style="Z-INDEX: 105; LEFT: 0px; POSITION: absolute; TOP: 478px"
    runat="server" ForeColor="Black" CellPadding="4" BackColor="#CCCCCC"
    CellSpacing="2" BorderWidth="3px" BorderStyle="Solid" BorderColor="#999999"
    AutoGenerateColumns="False" DataKeyField="AsiOrder#" DataMember="FormFields"
    DataSource="<%# dsCompany1 %>">
    <FooterStyle BackColor="#CCCCCC"></FooterStyle>
    <SelectedItemStyle Font-Bold="True" ForeColor="White"
    BackColor="#000099"></SelectedItemStyle>
    <ItemStyle BackColor="White"></ItemStyle>
    <HeaderStyle Font-Bold="True" ForeColor="White"
    BackColor="Black"></HeaderStyle>
    <Columns>
    <asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update"
    CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
    <asp:BoundColumn DataField="Date" SortExpression="Date"
    ReadOnly="True" HeaderText="Activation"
    DataFormatString="{0:d}">
    <ItemStyle Width="70px"></ItemStyle>
    </asp:BoundColumn>
    <asp:BoundColumn DataField="Region" SortExpression="Region"
    ReadOnly="True" HeaderText="Region">
    <ItemStyle Width="55px"></ItemStyle>
    </asp:BoundColumn>
    <asp:BoundColumn DataField="SIM" SortExpression="SIM"
    ReadOnly="True" HeaderText="SIM">
    <ItemStyle Width="50px"></ItemStyle>
    </asp:BoundColumn>

    <asp:BoundColumn DataField="SubAgentName"
    SortExpression="SubAgentName" ReadOnly="True" HeaderText="Sub Agent">
    <ItemStyle Width="60px"></ItemStyle>
    </asp:BoundColumn>
    <asp:BoundColumn DataField="CustomerName"
    SortExpression="CustomerName" ReadOnly="True" HeaderText="Customer">
    <ItemStyle Width="75px"></ItemStyle>
    </asp:BoundColumn>
    <asp:BoundColumn DataField="Account#" SortExpression="Account#"
    ReadOnly="True" HeaderText="Account">
    <ItemStyle Width="50px"></ItemStyle>
    </asp:BoundColumn>
    <asp:BoundColumn DataField="UserName" SortExpression="UserName"
    ReadOnly="True" HeaderText="User">
    <ItemStyle Width="60px"></ItemStyle>
    </asp:BoundColumn>



    </Columns>
    <PagerStyle HorizontalAlign="Left" ForeColor="Black"
    BackColor="#CCCCCC" Mode="NumericPages"></PagerStyle>
    </asp:datagrid></div>
    <asp:button id="btnExpExcel" style="Z-INDEX: 106; LEFT: 460px; POSITION:
    absolute; TOP: 984px"
    runat="server" Text="Export to Excel" Height="32px"></asp:button>
    </form>
    </body>


    "Chinmay" wrote:

    > Well! In this case I suggest you to seperate ur UI in Table Cells.
    > See the code
    > <table>
    > <tr>
    > <td>Ur Other Controls</td>
    > </tr>
    > <tr>
    > <td>ur Div and Datagrid</td>
    > </tr>
    > </table>
     
    =?Utf-8?B?cG11ZA==?=, Jan 25, 2005
    #8
  9. You'll have to remove Style tags which are specifying the position of the
    controls, and don't look at the UI that DEV Env. shows, run the page and than
    see for ur self!
     
    =?Utf-8?B?Q2hpbm1heQ==?=, Jan 26, 2005
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stephan Bour

    Making datagrid partially editable

    Stephan Bour, Jan 29, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    1,063
    Stephan Bour
    Jan 30, 2004
  2. Larry Rekow
    Replies:
    1
    Views:
    3,722
    Lucas Tam
    Aug 29, 2004
  3. Cahoo
    Replies:
    4
    Views:
    269
    Scott M.
    Aug 30, 2004
  4. Making editable datagrid.

    , Oct 13, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    162
  5. UJ
    Replies:
    1
    Views:
    595
    chandan
    Jan 15, 2007
Loading...

Share This Page