473,320 Members | 1,921 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,320 software developers and data experts.

how to get the value from textbox while editing data in webgrid

hi


im using webgrid control and i have used template columns to display the data from the database

while editing the data in webgrid, im storing the the new values in two strings for using it in update command.

but it is showing error like
'Unable to cast object of type 'System.Web.UI.LiteralControl' to type 'System.Web.UI.WebControls.TextBox'.

and my coding to get the values from the cells is

Dim sqlStr, str2, str1 As String

Dim intLid As Integer
intLid = C1WebGrid1.DataKeys.Item(e.Item.ItemIndex)
str1 = (CType(e.Item.Cells(1).Controls(0), TextBox)).Text
str2 = (CType(e.Item.Cells(2).Controls(0), Text
Dec 5 '07 #1
3 2308
kenobewan
4,871 Expert 4TB
Maybe a problem with this str2 = (CType(e.Item.Cells(2).Controls(0), Text. But which line is giving you the error to be sure?
Dec 5 '07 #2
hi

i m getting error in this line .
str1 = (CType(e.Item.Cells(1).Controls(0), TextBox)).Text



err is
'Unable to cast object of type 'System.Web.UI.LiteralControl' to type 'System.Web.UI.WebControls.TextBox'.
Dec 5 '07 #3
kenobewan
4,871 Expert 4TB
I'd suggest that your conversion is not working.
Dec 6 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: msnews.microsoft.com | last post by:
Hello. How can I set input mask for TextBox? Or can I use for mask input some other control?
1
by: Amadelle | last post by:
Hi all and thanks in advance for your help, I have a problem with capturing the changed value of a text box in a datagrid. The datagrid is populated based on a dataset and I am using template...
0
by: John Spiegel | last post by:
Hi all, As usual, I have found a way to make the straightforward, textbook example fail. I have a datagrid that supports editing. When I edit a row then fire the update, the value that gets...
1
by: Amadelle | last post by:
Hi all and thanks in advance for your help, I have a problem with capturing the changed value of a text box in a datagrid. The datagrid is populated based on a dataset and I am using template...
2
by: donnet | last post by:
Inside my .aspx file, I have a textbox populated with data from a dataset like this: <asp:TextBox text='<%# DataBinder.Eval(Container.DataItem, "Comment")%>' id="CommentText" runat="server"...
2
by: news.microsoft.com | last post by:
Hi guys, I have a problem with the DataGridView. I want to catch the value of a cell when the user is editing it. Actually, I can't figure if there is an event or a property to get this value. ...
3
by: durga2005 | last post by:
Hi I m displaying data from the database using C1WebGrid Control. When edit button is clicked two textboxes will be displayed in the corresponding row While editing the data through webgrid...
0
by: durga2005 | last post by:
hi i m using webgrid control and connected to database .while editing if i delete the values in two editable textbox, automatically my error message should disappear. my error mesage is displayed...
2
by: =?Utf-8?B?RHJEQkY=?= | last post by:
I understand that the Value put into a DataGridViewComboBoxCell has to be a member of the Items list or an exception is thrown. I also understand that you can override that exception by handling...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.