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:- -
<asp:GridView ID = "gvLv" runat = "server" AutoGenerateColumns = "False" DataKeyNames = "LID"
-
CellPadding="4" ForeColor="#333333" GridLines="None" OnRowEditing = "gvLv_RowEditing" OnRowUpdating = "gvLv_RowUpdating" >
-
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
-
<RowStyle BackColor="#EFF3FB" />
-
<Columns>
-
<asp:TemplateField HeaderText="LID" SortExpression="LID">
-
<ItemTemplate>
-
<asp:Label ID="lbl_Lid" runat="server" Text='<%# Bind("LID") %>'></asp:Label>
-
</ItemTemplate>
-
</asp:TemplateField>
-
<asp:TemplateField HeaderText="Lval" Visible ="true" SortExpression="Lval">
-
<EditItemTemplate>
-
<asp:TextBox ID="txt_Lval" runat="server" Text='<%# Bind("LVAL") %>' Visible = "true"></asp:TextBox>
-
</EditItemTemplate>
-
</asp:TemplateField>
-
<asp:CommandField ShowEditButton="True" />
-
</Columns>
-
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
-
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
-
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
-
<EditRowStyle BackColor="#2461BF" />
-
<AlternatingRowStyle BackColor="White" />
-
</asp:GridView>
My Events looks like this:- -
Protected Sub gvLv_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles gvLv.RowCancelingEdit
-
gvLv.EditIndex = -1
-
LoadGrid()
-
End Sub
-
-
Protected Sub gvLv_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles gvLv.RowEditing
-
gvLv.EditIndex = e.NewEditIndex()
-
LoadGrid()
-
End Sub
-
-
Protected Sub gvLv_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles gvLv.RowUpdating
-
rowlid = CType(gvLv.Rows(e.RowIndex).FindControl("lbl_Lid"), Label).Text
-
rowval = CType(gvLv.Rows(e.RowIndex).FindControl("txt_Lval"), TextBox).Text
-
oCAD.UpdateList(CType(rowlid, Int32), rowval)
-
LoadGrid()
-
End Sub
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
Sign in to post your reply or Sign up for a free account.
Similar topics |
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...
|
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.
|
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...
|
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...
|
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?
| |
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
|
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.
|
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
|
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...
|
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...
|
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,...
| |
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...
|
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,...
|
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...
|
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...
|
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();...
|
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...
| |
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
| |