473,416 Members | 1,559 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

Bind fields to functions

Hi,

I am using gridview for the user to update rows. In a row, there sre
two columns, which need to be updated. When the gridview is to be
shown, the row should show the values from database. When user clicks
on edit link, should display the windows loginId in one column and in
second column, show the current datetime. When user clicks on update
link, should save these two column values to database as well as other
updated field values. I can't seem to find out how to set this up.

The Source doe is as follows:
<asp:GridView ID="gcEvidence" runat="server" AllowPaging="True"
AllowSorting="True"
AutoGenerateColumns="False"
BackColor="LightGoldenrodYellow" BorderColor="Tan"
BorderWidth="1px" CellPadding="2"
DataKeyNames="FrameworkEvidenceId"
DataSourceID="DSFrameworkEvidenceSelectUpdate"
ForeColor="Black" GridLines="None" EmptyDataText="Sorry, no
records found." Font-Italic="False" Font-Size="1.2em" Width="100%">
<FooterStyle BackColor="Tan" />
<Columns>
<asp:CommandField ShowEditButton="True" />
<asp:BoundField DataField="ActionMasterDisplayNo"
HeaderText="Action No."
SortExpression="ActionMasterDisplayNo"
ReadOnly="True" />
<asp:BoundField DataField="ActionMasterDesc"
HeaderText="Action" SortExpression="ActionMasterDesc" ReadOnly="True"
/>
<asp:BoundField DataField="FrameworkEvidenceId"
HeaderText="FrameworkEvidenceId"
InsertVisible="False" ReadOnly="True"
SortExpression="FrameworkEvidenceId" Visible="False" />
<asp:TemplateField HeaderText="Evidence Achieved"
SortExpression="FrameworkEvidenceAchieved">
<EditItemTemplate>
<asp:DropDownList ID="cboAchieved"
runat="server" SelectedValue='<%# Bind("FrameworkEvidenceAchieved")
%>'>
<asp:ListItem
Value="-">--Select--</asp:ListItem>
<asp:ListItem
Value="yes">Yes</asp:ListItem>
<asp:ListItem Value="no">No</asp:ListItem>
<asp:ListItem Value="partial
progress">Partial Progress</asp:ListItem>
<asp:ListItem Value="not applicable">Not
Applicable</asp:ListItem>
</asp:DropDownList>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%#
Bind("FrameworkEvidenceAchieved") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Evidence Ref"
SortExpression="FrameworkEvidenceRef">
<EditItemTemplate>
<asp:TextBox ID="txtEvidenceRef" runat="server"
MaxLength="150" Text='<%# Bind("FrameworkEvidenceRef")
%>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%#
Bind("FrameworkEvidenceRef") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Evidence Desc"
SortExpression="FrameworkEvidenceDesc">
<EditItemTemplate>
<asp:TextBox ID="txtEvidenceDesc"
runat="server" MaxLength="8000" Text='<%# Bind("FrameworkEvidenceDesc")
%>'
TextMode="MultiLine"></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%#
Bind("FrameworkEvidenceDesc") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Updated By"
SortExpression="FrameworkEvidenceUpdatedBy">
<EditItemTemplate>
<asp:TextBox ID="txtUpdatedBy" runat="server"
MaxLength="10" Text='<%# GetLoggedInUserId() %>'
</asp:TextBox></EditItemTemplate>

<ItemTemplate> <asp:Label
ID="Label5" runat="server" Text='<%# Bind("FrameworkEvidenceUpdatedBy")
%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Date"
SortExpression="FrameworkEvidenceUpdatedDate">
<EditItemTemplate>
<asp:TextBox ID="txtDate" runat="server"
ReadOnly="True" Text='<%#
getCurrentDateTime(Eval("FrameworkEvidenceUpdatedD ate"))
%>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label4" runat="server" Text='<%#
Bind("FrameworkEvidenceUpdatedDate") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<SelectedRowStyle BackColor="DarkSlateBlue"
ForeColor="GhostWhite" />
<PagerStyle BackColor="PaleGoldenrod"
ForeColor="DarkSlateBlue" HorizontalAlign="Center" />
<HeaderStyle BackColor="Tan" Font-Bold="True" />
<AlternatingRowStyle BackColor="PaleGoldenrod" />
<EditRowStyle BackColor="#8080FF" BorderColor="Blue"
Font-Size="1em" />
</asp:GridView>
<asp:SqlDataSource ID="DSFrameworkEvidenceSelectUpdate"
runat="server" ConnectionString="<%$ ConnectionStrings:EqualitiesDbConn
%>"
SelectCommand="ProcFrameworkEvidenceSelectALLByDep tId"
SelectCommandType="StoredProcedure"
UpdateCommand="ProcFrameworkEvidenceUpdate"
UpdateCommandType="StoredProcedure">
<UpdateParameters>
<asp:Parameter Name="FrameworkEvidenceId" />
<asp:Parameter Name="FrameworkEvidenceDesc" />
<asp:Parameter Name="FrameworkEvidenceRef" />
<asp:Parameter Name="FrameworkEvidenceAchieved" />
<asp:Parameter Name="FrameworkEvidenceUpdatedBy" />
<asp:Parameter Name="FrameworkEvidenceUpdatedDate" />
</UpdateParameters>
<SelectParameters>
<asp:Parameter DefaultValue="3" Name="dept_id"
Type="Int64" />
</SelectParameters>
</asp:SqlDataSource>

Apr 19 '06 #1
0 1676

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

Similar topics

4
by: Arturo Cuebas | last post by:
The program below contains a compile error. Following the program you will find the typical fix then my idea for a library that facilitates a more elegant fix. #include <boost\bind.hpp> using...
2
by: Smartin | last post by:
Using Access 97 I am trying to create a form that allows for user entry of search terms and displays a table of results. I thought I could accomplish this using a subform but it isn't quite...
7
by: Jed | last post by:
I have a web service method that returns an array of custom objects marked serializeable with fully described public properties. When I bind the results to a DataGrid I can access the properties...
1
by: Luis Esteban Valencia | last post by:
Please everybody participate in this question. Hello my applicacion has many layers and classes and I think its well structured. PLease let me know if you disagree and why. 1. I have the user...
0
by: Webbyz | last post by:
Here is my problem. I have 2 fields fSeason and rSeason in my database. These hold the String values of either Spring or Fall. I have a comboBox in my form that i am trying to bind on load to...
2
by: darren.murray2 | last post by:
Hello all, I'm fairly new at this so I may be doing this the wrong way but I've got a FormView within a multiview that when it is updated in edit mode, will call on the update method associated...
1
by: Peter Michaux | last post by:
Hi, I saw Brendan Eich in an online conference video say that in JavaScript 2 that they will lexically bind the "this" keyword of inner functions. He said that currently the execution-time...
1
by: adolph | last post by:
I wrote an access2000 database for a POS system. In it is a sales form with a a subform showing the items being purchased. The main form is unbound. It uses a class to hold the main form data...
0
by: dan | last post by:
Hi, I have a form that displays record fields. The record has a 'type' field. I'd like to use different controls for one of the fields based on the type. I initially thought of putting all...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
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
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...
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,...
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...

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.