473,473 Members | 2,282 Online
Bytes | Software Development & Data Engineering Community
Create 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 Programmatically.

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

My Question:
1) My EditITemTemplate 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 6682
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
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...
4
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...
1
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...
1
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...
2
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...
2
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...
2
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...
2
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...
0
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...
0
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...
0
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,...
0
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...
0
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,...
1
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...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.