473,791 Members | 3,071 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 2103

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

Similar topics

6
2397
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
5431
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
14316
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
1373
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
42071
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
10792
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
10408
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
5030
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
9669
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
10427
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...
1
10155
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9995
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9029
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
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5431
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4110
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
3718
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.