I have a gridview there are two check box fields on the gridview. What I'm
tring to do is when the record is edited if the check boxes have changed
update another field that is a hidden field on the gridview.
I'm thinking I can do this in the RowUpdating event. I just don't know how
to do this. below is the basic gridview code
<body>
<form id="form1" runat="server">
<div>
<asp:SqlDataSource ID="SqlEventList" runat="server"
ConnectionString="<%$ ConnectionStrings:MicroWe_vs1ConnectionString %>"
SelectCommand="SELECT [IndEventID], [tbDay], [tbWeek], [tiGroup]
FROM [MICRO_tblEventIndividual]">
updatecommand = "UPDATE [MICRO_tblEventIndividual] set
tiGroup=@tiGroup where IndEventID = @IndEventID
</asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server"
DataSourceID="SqlEventList"
AutoGenerateColumns="False">
<Columns>
<asp:CommandField ShowEditButton="True" />
<asp:BoundField DataField="IndEventID"
HeaderText="IndEventID"
InsertVisible="False" ReadOnly="True"
SortExpression="IndEventID" />
<asp:BoundField DataField="tbDay" HeaderText="tbDay"
SortExpression="tbDay" />
<asp:BoundField DataField="tbWeek" HeaderText="tbWeek"
SortExpression="tbWeek" />
<asp:BoundField DataField="tiGroup" HeaderText="tiGroup"
InsertVisible="False" ReadOnly="True"
SortExpression="tiGroup" />
</Columns>
</asp:GridView>
</div>
</form>
</body>
and below is the RowUpdating idea taht I want to do.
Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles
GridView1.RowUpdating
tiGroup = 0
if tbWeek then
tiGroup = 4
end
if tbday then
tiGroup =+ 2
end
End Sub
via e (as GridViewUpdateEventArgs) you should be able to access what's
there like e.NewValues or e.OldValues (depending were those changed at
all)...
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridviewupdateeventargs.aspx
--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net
"Kirk Groome" <ki...@micrometric.com> wrote in message
news:835D1497-49E9-4809...@microsoft.com...