473,769 Members | 5,885 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Grid view Edit Item Template column not visible.

5 New Member
I have a grid which i bind with values from Database. I have events to edit and update the grid. I am not using SqlDatasource to connect to DB. Rather i am doing the updating of the grid Programmaticall y.

I have 3 columns, LID(item template column) ,LVal (Edit Item template column) and Edit link

My Question:
1) My EditITemTemplat e column has a textbox txt_Lval which does not show up on the page load. But if click on edit link that particular row alone shows that edit item template column which has been invisible. I cannot see the column in design view itself. But if i change that to an Item template column it shows up in edit mode. I want to show it in edit mode only after user clicks Edit link

I have no idea what is going on with that invisible edit item template column which suddenly shows up during edit. The user should be able to see LVal column.

I am able to edit and update the row and insert the updated values back into DB.

Thank you for your help in Advance.

My grid details:-
Expand|Select|Wrap|Line Numbers
  1. <asp:GridView ID = "gvLv" runat = "server" AutoGenerateColumns = "False" DataKeyNames = "LID" 
  2. CellPadding="4" ForeColor="#333333" GridLines="None" OnRowEditing = "gvLv_RowEditing" OnRowUpdating = "gvLv_RowUpdating" > 
  3. <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
  4. <RowStyle BackColor="#EFF3FB" />
  5. <Columns> 
  6. <asp:TemplateField HeaderText="LID" SortExpression="LID">
  7. <ItemTemplate>
  8. <asp:Label ID="lbl_Lid" runat="server" Text='<%# Bind("LID") %>'></asp:Label> 
  9. </ItemTemplate>
  10. </asp:TemplateField>
  11. <asp:TemplateField HeaderText="Lval" Visible ="true" SortExpression="Lval">
  12. <EditItemTemplate>
  13. <asp:TextBox ID="txt_Lval" runat="server" Text='<%# Bind("LVAL") %>' Visible = "true"></asp:TextBox>
  14. </EditItemTemplate>
  15. </asp:TemplateField>
  16. <asp:CommandField ShowEditButton="True" />
  17. </Columns> 
  18. <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
  19. <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
  20. <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
  21. <EditRowStyle BackColor="#2461BF" />
  22. <AlternatingRowStyle BackColor="White" />
  23. </asp:GridView>
My Events looks like this:-
Expand|Select|Wrap|Line Numbers
  1. Protected Sub gvLv_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles gvLv.RowCancelingEdit
  2. gvLv.EditIndex = -1
  3. LoadGrid()
  4. End Sub
  5.  
  6. Protected Sub gvLv_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles gvLv.RowEditing
  7. gvLv.EditIndex = e.NewEditIndex()
  8. LoadGrid()
  9. End Sub
  10.  
  11. Protected Sub gvLv_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles gvLv.RowUpdating
  12. rowlid = CType(gvLv.Rows(e.RowIndex).FindControl("lbl_Lid"), Label).Text
  13. rowval = CType(gvLv.Rows(e.RowIndex).FindControl("txt_Lval"), TextBox).Text
  14. oCAD.UpdateList(CType(rowlid, Int32), rowval)
  15. LoadGrid()
  16. End Sub
Jul 28 '08 #1
1 6748
Frinavale
9,735 Recognized Expert Moderator Expert
The Edit Item Template only appears when the user is Editing that row....
Therefore, the user must click the edit button before this becomes available to them.

You should look into using the ItemTemplate to accomplish what you are attempting to implement.

-Frinny
Jul 28 '08 #2

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

Similar topics

3
2743
by: Simon Harris | last post by:
Hi All, I have a data grid which displays country names. I now wish to display the country flag images above the names. Can someone please advise how I display an image in a datagrid? I have a folder of flag images, named in relations to the countries database ID. Current data grid code is...
4
1261
by: Bazza Formez | last post by:
Hi there, What determines the sizes of rows / columns / cells when a grid is in edit mode ? When I click the edit command of a row item, the whole grid 'bounces' to a much larger size... and after update it reduces back again. I have a custom crafted grid (AutoGenerateColumns = False) ... and can have not placed any setting that would seem to cause this behaviour.
1
1077
by: Chris | last post by:
I have a need to automatically save a record when a user leaves me form. Everything works great unless the user uses the grid and selects an item via a link column. Then I can't capture the record save (whihc I do via images buttons; save and add detail record). The routine runs the btn_save command for me (then I determine is save new or modify). Any ideas on how to run my routine if the user selects a grid item (detail item)? Here's...
1
4975
by: Mad Scientist Jr | last post by:
can someone explain how to simply populate a grid in .net ? the way i understand it, there is no more msflexgrid, and instead is this new control that has to be tied to a dataset, and it is a real pain to work with if you just want to throw some values in a grid and edit them with a textbox. i don't want to persist anything in a database, i just need a fast cheap and easy grid in memory that i can work with! i had functions in vb6 that...
2
4282
by: Joe Griffith | last post by:
I'm using a Win Forms Data Grid View control in unbound mode. When I add columns using the wizard the first item is the column name. Everything works fine. However, if you return to the columns collection and look at the poperties of an individual column the name property is not in the list. Is there a way to change (or even find) the name of a column in a data grid view other than looking at it in the *.Designer.vb file?
2
2804
by: Smokey Grindle | last post by:
I have the following on my page... a link button that will send the command name "use" to the command handler and a grid view with the following columns 0 - Template column - just a checkbox (asp.net control) 1 - Bound column - DisplayName from data table the checkbox is just a template i made by placeing an asp.net control into the item template when I check items on the grid then click the link and execute the following
2
9454
by: puja | last post by:
hi all, i have a grid view where am displaying data from dataset. My dataset consists of columns Customer name, surname, date requested, sales person, file number , status and comments I am displaying all columns in grid view except comments. Now I want to have comments displayed (for each row) as tooltip when u hover over particular row.
2
7233
by: =?Utf-8?B?Z2FuZQ==?= | last post by:
Hi, In a gridview, How can i display different columns between item and edit modes. For eg. i have a sql that returns productname, categoryname, etc. In viewmode, i need to display only productname column and not categoryname column. Again in Edit mode, i need display/edit category name only. But not productname column shouldnt be displayed/editable. In visual studio 2005, I tried converting the columns to template fields and
0
1124
by: =?Utf-8?B?VGVjaGVlaw==?= | last post by:
I am building one application is VB.NET. I am using a grid, but facing some problems related to it. 1) I am using .Net 1.1. I have used a datagrid.I have added a template column in the datagrid.I item template of that datagrid.I I have bind a label to the column and in edit item template I have bind a dropdown to it so that when u load the data in the grid on form load u can only see the data in that column but once when u...
0
9589
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
9423
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
10045
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...
1
9994
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
9863
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
8872
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
6673
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
5299
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
3959
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

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.