473,804 Members | 3,324 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Gridview and EmptyDataTempla te in Edit mode

Hi,

I am using the gridView control at first the EmptyInsert command is
executed from the EmptyDataTempla te but when a user clicks Edit after
the 1st insert, for some reason it detects the rowtype as empty datarow
and does not go to Edit mode but displays all the controls from
EmptyDataTempla te instead.

what am i missing?
protected void gvProducts_RowE diting(object sender,
GridViewEditEve ntArgs e)
{
gvProducts.Edit Index = e.NewEditIndex;
gvProducts.Show Footer = false; // We also turn off the add
screen while updating data
BindgvProducts( );
}

<asp:TemplateFi eld HeaderText="Qua ntity">
<ItemTemplate >
<asp:Label ID="lblQty" runat="server" Text='<%# Eval("Quantity" )
%>'></asp:Label>
</ItemTemplate>
<EditItemTempla te>
<asp:TextBox ID="txtQty" runat="server" Text='<%# Bind("Quantity" )
%>'></asp:TextBox>
</EditItemTemplat e>
<FooterTemplate >
<asp:TextBox ID="txtQty" runat="server"> </asp:TextBox>
</FooterTemplate>
</asp:TemplateFie ld>
<asp:TemplateFi eld>
<EditItemTempla te>
<asp:LinkButt on ID="LinkButtonU pdate" runat="server"
CausesValidatio n="true" CommandName="Up date" Text="Update" />
<asp:LinkButt on ID="LinkButtonC ancel" runat="server"
CausesValidatio n="False" CommandName="Ca ncel" Text="Cancel" />
</EditItemTemplat e>
<FooterTemplate >
<asp:Button Text="Insert" CommandName="In sert" CausesValidatio n="true"
runat="server" ID="btInsert" UseSubmitBehavi or="false" />
</FooterTemplate> </asp:TemplateFie ld>
<EmptyDataTempl ate>
<table>
<tr><td>Selec t Product</td><td>Quantity </td></tr>
<tr>
<td><asp:DropDo wnList ID="ddEmptyProd uctList"
runat="server"> </asp:DropDownLis t></td>
<td><asp:TextBo x ID="txtEmptyQty "
runat="server"> </asp:TextBox></td></tr></table>
<asp:Button ID="btSend" Text="Insert" class="inputBtn s" runat="server"
CausesValidatio n="false" CommandName="Em ptyInsert"
UseSubmitBehavi or="false" />
</EmptyDataTempla te>

Jul 20 '06 #1
0 2104

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2398
by: Dabbler | last post by:
I have a GridView with a couple of TemplateFields. When I click the update link the Gridview returns to display mode with no errors but the data from bound text fields or dropdown list isn't updated in the table. I'm stumped and any help would be appreciated. Thanks much. My GridView: <asp:GridView ID="VanListGridView" runat="server"
5
5433
by: teclioness | last post by:
Hi, I am using gridview and sql datasource for select and update. When I click on edit link against the records, the row is shows in edit mode. When I make a change to it, the change is not updated and no errors returned. Here is the source.. Please help. <asp:GridView ID="gvEvidence" runat="server" AllowPaging="True" AllowSorting="True"
0
1109
by: Dabbler | last post by:
I'm getting this error after adding a simple button to the EmptyDataTemplate Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.] Here's my...
1
14317
by: CorporateCoder | last post by:
Hi, I am trying to bind the selected value of a databound dropdown box in a databound gridview control to the value being displayed in the template column the dropdown box has been added to. Both the grid and the dropdown box are retrieving and displaying data fine, I just cant bind the two together. I followed the instructions in the help document called 'Walkthrough: Displaying a Drop-Down List While Editing in the GridView Web...
1
1376
by: Jeff | last post by:
Hey asp.net 2.0 I have this GridView in my web page. My problem is that it get populated with all the fields of the MembershipUser class. I thought only UserName would be displayed, but it displays all fields <asp:GridView ID="gvwOnline" runat="server"> <Columns>
13
42074
by: AG | last post by:
I have a gridview that I bind to a List(of Type) at runtime. Not using a datasource control. The gridview has a template column with an imagebutton whose commandname is set to 'Delete'. The footer template has an commandbutton with the commandname set to 'Insert'. Both buttons cause postback, however the RowCommand event does not fire. How can I get the rowcommand to fire?
13
10793
by: Tomasz Jastrzebski | last post by:
Helo All, The problem: GridView control does not render at all (header/footer) when the data source is empty. I have seen a similar question posted already, but I just can not believe there is no simple solution. I do not believe ASP.Net team took this, sort of, innovative approach and left no way out. Could anybody advise?
1
10409
by: Evan M. | last post by:
Here's my GridView and my SqlDataSource <asp:GridView ID="ContactHistoryGrid" runat="server" AutoGenerateColumns="False" DataSourceID="ContactHistoryDS" DataKeyNames="JobHistoryID" OnRowCreated="ContactHistoryGrid_RowCreated" CssClass="GridViewTable" GridLines="None" CellSpacing="1" CellPadding="3" AllowSorting="True" AllowPaging="True"> <EmptyDataTemplate>
1
5032
by: needhelp1 | last post by:
I have gridview with a detailsview below. When I click on 'New' in brings up the DetailsView for inserting. When I click on 'Edit' in does not brink up the DetailsView. What am I doing wrong? I totally at a loss, please help. I don't know if I need to something to grdUserProfile_RowEditing. Thank you! This is some of my code behind: protected void grdUserProfile_RowEditing(object sender, GridViewEditEventArgs e) { } protected void...
0
9705
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9576
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10567
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10323
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9138
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4291
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3809
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2983
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.