473,664 Members | 2,797 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

detilsview problem with EditItemTemplat e

57 New Member
HI All,

I have a details view in which i have a template column which contains a item template which contains a label(lblUser).

i am displaying some values on the label using

((Label)Details View1.FindContr ol("lblUser")). Text=UserLevel;

everything is fine till now...

now i want to add a EditItemTemplat e to this.

As soon as i add a EditItemTemplat e the above line throws the error(Object reference not set to an instance of an object.)(null referance exception)

i think it is not able to find the lblUser control now but why?????

can someone help me on this please......

Regards,

Vineet

below is the code for my detailsview


<asp:DetailsVie w Runat="Server" ID="DetailsView 1" FieldHeaderStyl e-Font-Bold="true"
FieldHeaderStyl e-HorizontalAlign ="Right" DefaultMode="Re adOnly"
AutoGenerateDel eteButton="True " AutoGenerateEdi tButton="True"
AutoGenerateIns ertButton="True " AutoGenerateRow s="False" BorderStyle="No ne"
BorderWidth="1p x" CaptionAlign="L eft" CellPadding="3" CssClass="Norma l"
EmptyDataText=" There are no records." Visible="False" >

<FieldHeaderSty le HorizontalAlign ="Right" Font-Bold="True" ></FieldHeaderStyl e>
<Fields>


<asp:TemplateFi eld HeaderText="Use rLevel">
<EditItemTempla te></EditItemTemplat e>
<ItemTemplate >
<asp:Label ID="lblUser" runat="server" Text='<%# Bind("UserLevel ") %>'></asp:Label>
</ItemTemplate>

</asp:TemplateFie ld>

<asp:TemplateFi eld HeaderText="Sta tus">
<ItemTemplate >
<asp:Label ID="lblStatus" runat="server" Text='<%# Bind("StatusLev el") %>'></asp:Label>
</ItemTemplate>


</asp:TemplateFie ld>

<asp:TemplateFi eld HeaderText="Act ionLevel">
<ItemTemplate >
<asp:Label ID="lblAction" runat="server" Text='<%# Bind("ActionLev el") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateFie ld>

<asp:TemplateFi eld HeaderText="Typ eLevel">
<ItemTemplate >
<asp:Label ID="lblType" runat="server" Text='<%# Bind("TypeLevel ") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateFie ld>

</Fields>
</asp:DetailsView >
Jan 27 '09 #1
1 1107
vineetbindal
57 New Member
also even if i try to change the defoultmode of the detailsview from "insert" to anything ele it throws me the same exception..


please help people
Jan 27 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

8
2328
by: Gilles T. | last post by:
How I can get element ID in the edit mode of datagrid control? If I not in the edit mode, there are no problem. <asp:TemplateColumn ItemStyle-CssClass="grid_column_width_3" ItemStyle-HorizontalAlign="center" ItemStyle-VerticalAlign="top"> <ItemTemplate><%# CType(Container.DataItem("DateStatut"),DateTime).ToString("yyyy-MM-dd") %></ItemTemplate> <EditItemTemplate> <asp:TextBox width="80" CssClass="edit_item" id="txtDateStatut"
8
2000
by: David | last post by:
This is something I had never seen before. On an aspx page, upon pressing a link button for which I have an event handler in the code behind, the screen shows nothing but a line that says "true" up in the right upper corner of the browser. I have an XP and had just installed XP Service Pack II...against my better judgment. Please help. Thanks.
1
1443
by: I am Sam | last post by:
I need to be able to delete a record/row from a database table. I am using a DataGrid which is not sending the row index key properly to the event in the codebehind. When I set a break point and check the values in the Autos window e.Items.ItemIndex always returns a 0 so the stored procedure does not know which record to delete. Here is the Datagrid markup: <asp:datagrid id="clubdg" DataKeyField="UserID" runat="server"...
2
6544
by: Robert Smith jr. | last post by:
Hello, Please pardon my newbie question ... I am building an ASP.NET page that displays a recordset with a Delete statement enabled (this all works fine). I want to Insert the current row *that is going to be deleted* into another table, before the original data is deleted. I am trying to use the RowDeleting method to call an Update or Insert
9
5328
by: Timm | last post by:
I have an ASP.NET 2.0 page with two DropDownLists. I am using declarative data binding wherever possible and trying to minimize the use of code. The list of values in DropDownList DDL2 should be (filtered) dependent upon the selection in DDL1. I think this inevitably needs some code, but I'd be happy to be told otherwise! I have some code to handle OnSelectedIndexChanged for DDL1 that sets the FilterExpression associated with the...
0
1138
by: dch | last post by:
I have a GridView, and when I click Edit, it is firing the OnRowEditing event ,and I am setting the edititem index, but it keeps displaying the ItemTemplate fields instead of the EditItemTemplate. I have done this before, but I can't figure out why it is ignoring the EditItem Template. I have my code below. Basically, I am storing a "work" table in a session variable, adn I bind that table to the grid, so I don't want to use a datasource. ...
0
1975
by: KeesH | last post by:
Hi, I am quite desperate now because I made a nice webshop with a gridview where the customer is able to update the amount of products (Hostas in my situation) or delete the row. The problem is that every works really fine with this code when customers order approximatelly a maximum of 35 products. What I learned so far is to set the EnableViewState="False" for all the labels that don't need a viewstate. This helped a lot. What can I do...
0
1017
by: ashwin | last post by:
I have a Data Grid to display employee names and codes. On clicking a button (outside the datagrid) I perform some calculations which sets the fields of other columns in the datagrid. The problem I am facing is that not all columns are filled with values resulting from the calculations. Only the first few rows are being filled with results. ...
0
919
by: ashwin | last post by:
I have a Data Grid to display employee names and codes. On clicking a button (outside the datagrid) I perform some calculations which sets the fields of other columns in the datagrid. The problem I am facing is that not all columns are filled with values resulting from the calculations. Only the first few rows are being filled with results. ...
0
8861
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
8636
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
7375
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...
1
6187
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5660
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
4185
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...
0
4351
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2764
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
2003
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.