well check out this way
Dim Email As TableCell = E.Item.Cells(1)
Dim Share As TableCell = E.Item.Cells(7)
then
Dim strEmail as String = Email.ToString()
Dim strShare as String = Share.ToString()
Hope this should help u...
keep me posted
==============================
S.Ramanujam
Programmer Analyst
Cognizant Technology Solutions (p) Ltd. - CTS
38 & 39 Whites Road,
WCB - Whites Road Circular Building
Royapettah, Chennai - 600014
Ph : +xx xx xxx xxxx Extn 5113 [Off]
: +xx xx xxx xxxx [Res]
-----Original Message-----
From: Handoyo [mailto:handoyokristanto@t...]
Sent: Wednesday, September 18, 2002 6:58 AM
To: ASPX_Professional
Subject: [aspx_professional] RE: Ask SQL Command
Hello Tom Phan
i have big problem with dataGrid could you help me please ?
This is my probelm :
1. Why i can not convert E.Item.Cells(xx) to integer or other data type?
2. How to use checkbox in BoundColumn not in TemplateColumn ? (to update
share value)
This is my code :
sub DataGrid1_Update(obj as object, e as DataGridCommandEventArgs)
Dim Email As string = Ctype(E.Item.Cells(1).text, string)
Dim Share As String = Ctype(E.Item.Cells(7).text, string)
************************The
Problem**************************************************
Dim RegDate As date = Ctype(E.Item.Cells(9).text, date)
'why when i want to Convert E.Item.Cells(9).text to date is always failed?
then how to do that?
Dim RoleId As integer = Ctype(E.Item.Cells(10).text, integer)
'Convert from E.Item.Cells(9) --> to integer ? --> this is failed too!
Dim UserId As integer = Ctype(E.Item.Cells(0).Text, integer)
****************************************************************************
*********
Dim UpdateFlag as Boolean = UpdateUser(EmailShare,RoleId,UserId)
DataGrid1.EditItemIndex = -1
DataGrid1.DataBind()
end sub
<form runat="server" ID="Form1">
<asp:DataGrid id="DataGrid1" runat="server"AutoGenerateColumns="false"
OnEditCommand="DataGrid1_Edit" OnCancelCommand="DataGrid1_Cancel"
OnUpdateCommand="DataGrid1_Update" AllowPaging="true" PageSize="10"
PagerStyle-Mode="NumericPages" PagerStyle-PageButtonCount="4"
OnPageIndexChanged="DataGrid1_PageIndexChanged">
<Columns>
<asp:BoundColumn DataField="UserId" HeaderText="UserId"
ReadOnly="True"></asp:BoundColumn>
<asp:BoundColumn DataField="Email" HeaderText="E-mail"></asp:BoundColumn>
<asp:BoundColumn DataField="Share" HeaderText="Share"></asp:BoundColumn>
<asp:BoundColumn DataField="RegDate" HeaderText="RegDate"></asp:BoundColumn>
<asp:TemplateColumn HeaderStyle-HorizontalAlign=Center HeaderText="X">
<ItemTemplate>
<asp:checkBox runat=server checked='<%#Container.DataItem("share")
%>' \>
</ItemTemplate>
</asp:TemplateColumn>
*************
this is success to load, but failed if i want to change the value. --> this
is became unrecognize able field?? then how to update this value (share
value) ?
<asp:BoundColumn DataField="RoleId" HeaderText="RoleId"></asp:BoundColumn>
<asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update"
HeaderText="Edit" CancelText="Cancel" EditText="Edit">
<ItemStyle Wrap="False"></ItemStyle>
</asp:EditCommandColumn>
</Columns>
</asp:DataGrid>
Thank You,
Handoyo
----------------------------------------------------------------------------
--
> Khusus Pelanggan Telepon DIVRE 2, Tekan 166 untuk mendengarkan pesan Anda
----------------------------------------------------------------------------
--
---
ASP.NET 1.0 Namespace Reference with C#
http://www.wrox.com/acon11.asp?ISBN=1861007442
ASP.NET 1.0 Namespace Reference with VB.NET
http://www.wrox.com/acon11.asp?ISBN=1861007450
These books are a complete reference to the ASP.NET namespaces
for developers who are already familiar with using ASP.NET.
There is no trivial introductory material or useless .NET
hype and the presentation of the namespaces, in an easy-to use
alphabetical order ensures a user-friendly reference format.
We provide in-depth coverage of all the major ASP.NET classes,
giving you those real-world tips that the documentation doesn't
offer, and demonstrating complex techniques with simple
examples.
---