Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > BOOK: Beginning ASP.NET 1.0
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 1.0
This is the forum to discuss the Wrox book Beginning ASP.NET 1.0 with C# by Chris Goode, John Kauffman, Christopher L. Miller, Neil Raybould, S. Srinivasa Sivakumar, Dave Sussman, Ollie Cornes, Rob Birdwell, Matt Butler, Gary Johnson, Ajoy Krishnamoorthy, Juan T. Llibre, Chris Ullman; ISBN: 9780764543708
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 1.0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 24th, 2004, 12:13 AM
shs shs is offline
Authorized User
Join Date: Mar 2004
Location: , , New Zealand.
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default Editing Datagrid with hyperlink column

I have a datagrid to edit. when I make one of the columns in the datagrid hyperlinked I can not edit it anymore and I get error msg. here is my code:

Sub MyGrid_Update(sender As Object, e As DataGridCommandEventArgs)

Dim strCompId as Integer = e.Item.Cells(1).Text
Dim strCompName as String = CType(e.Item.Cells(2).Controls(0), TextBox).Text

Dim strSQL as String = "UPDATE [company] SET [comp_name] = @comp_name where [comp_id] = @comp_id"

.....opening the connection...

 Dim parameterName as OleDbParameter = new OleDbParameter("@comp_name", OleDbType.VarWChar, 50)
        parameterName.Value = strCompName
   Dim parameterIdno as OleDbParameter = new OleDbParameter("@comp_id", OleDbType.Integer)
        parameterIdno.Value = strCompId

        MyGrid.EditItemIndex = -1
End Sub
here is the grid:
                                <asp:EditCommandColumn EditText=" Edit " ButtonType="PushButton"
    UpdateText="Update" CancelText="Cancel" />

HeaderText="ID" DataNavigateUrlField="comp_id"

the code works fine when I use
<asp:BoundColumn HeaderText="ID" DataField="comp_id" ReadOnly="true"/>
instead of above hyperlinkcolumn
(I just want to update the company name)

<asp:BoundColumn HeaderText="Company Name" DataField="comp_name"
    ItemStyle-HorizontalAlign="Left" />

here is the error:

 Exception Details: System.FormatException: Input string was not in a correct format.

Source Error:

Line 65: Sub MyGrid_Update(sender As Object, e As DataGridCommandEventArgs)
Line 66:
Line 67: Dim strCompId as Integer = e.Item.Cells(1).Text
Line 68: Dim strCompName as String = CType(e.Item.Cells(2).Controls(0), TextBox).Text
Line 69: Dim strCom


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Doubts on DataGrid Hyperlink Column saravananedu ASP.NET 2.0 Basics 0 April 3rd, 2007 08:37 AM
Datagrid Button/Hyperlink Column snowydust VB How-To 0 September 6th, 2004 02:14 AM
DataGrid hyperlink column error burdickdave ASP.NET 1.x and 2.0 Application Design 3 February 26th, 2004 03:41 PM

All times are GMT -4. The time now is 12:03 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.