Click here to Skip to main content
15,878,543 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using Gridview with object datasource. When I click on Edit link to go into edit mode, the entire gridview goes out of page.

I will appreciate any help.
db7uk 31-May-12 15:20pm    
Can you provide any code? does your edit item template contain any incorrect HTML formatting or styles?
Member 9056232 31-May-12 15:23pm    
I am not using Edit Item Template. Here is my code -

<asp:ObjectDataSource ID="odsCustomer" runat="server" DataObjectTypeName="NIEHS.Northwind.Prototype.EDM.Customer"
TypeName="NIEHS.Northwind.Prototype.Web.DataSources.CustomerDS" SelectMethod="GetCustomers"
InsertMethod="AddCustomer" UpdateMethod="UpdateCustomer" DeleteMethod="DeleteCustomer"
OnSelected="OnCustomerSelected" OnInserted="OnCustomerInserted" OnDeleted="OnCustomerDeleted"
OnUpdated="OnCustomerUpdated" />
<div id="customerMaintenance">
<asp:Label ID="error" runat="server" Text="" Visible="false" CssClass="ErrorMessage">
<asp:GridView ID="customers" runat="server" DataSourceID="odsCustomer" AllowPaging="True"
AutoGenerateColumns="False" CssClass="table" AlternatingRowStyle-CssClass="AlternatingRowStyle"
RowStyle-CssClass="RowStyle" SelectedRowStyle-CssClass="SelectedRowStyle" ItemStyle-CssClass="GridViewEditMode">
<alternatingrowstyle cssclass="AlternatingRowStyle">
<asp:BoundField DataField="CustomerID" HeaderText="CustomerID" InsertVisible="False"
ReadOnly="True" SortExpression="CustomerID" />
<asp:BoundField DataField="CompanyName" HeaderText="CompanyName" SortExpression="CompanyName" />
<asp:BoundField DataField="ContactName" HeaderText="ContactName" SortExpression="ContactName"/>
<asp:BoundField DataField="ContactTitle" HeaderText="ContactTitle" SortExpression="ContactTitle" />
<asp:BoundField DataField="Address" HeaderText="Address" SortExpression="Address" />
<asp:BoundField DataField="City" HeaderText="City" SortExpression="City"/>
<asp:BoundField DataField="Region" HeaderText="Region" SortExpression="Region"/>
<asp:BoundField DataField="PostalCode" HeaderText="PostalCode" SortExpression="PostalCode"/>
<asp:BoundField DataField="Country" HeaderText="Country" SortExpression="ReorderLevelCountry"/>
<asp:BoundField DataField="Phone" HeaderText="Phone" SortExpression="Phone" />
<asp:BoundField DataField="Fax" HeaderText="Fax" SortExpression="Fax"/>
<asp:CommandField ButtonType="Link" ShowInsertButton="true" ShowDeleteButton="true"
ShowEditButton="true" ShowCancelButton="true" ShowSelectButton="True" />

<SelectedRowStyle CssClass="SelectedRowStyle"></SelectedRowStyle>

db7uk 31-May-12 15:37pm    
mmmm Can you provide the SelectedRowStyle css? Also this seems to be set twice? also when you say it goes off screen, is it the whole grid or just the row you are editing? Have you tried removeing the CSS from the grid? also what browser and are you in an AJAX panel?
Member 9056232 31-May-12 15:50pm    
I think SelectedRowStyle css should not affect as it has -
COLOR: black;

The whole grid goes off screen. I am using IE9 and not using AJAX panel.

1 solution

when you edit a row with BoundField, any column show a large textbox for inserting data.
You can customize textbox size with css (CssClass="SelectedRowStyle") and make your grid more friendly.

you can also use a master/detail with detailview (above grid or in popUpmode) for full customize your input form.

use this:[^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900