TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Jes Sie
739
1.2k
280.2k
Unable to cast object of type 'System.Web.UI.WebControls.Tex
Oct 4 2017 3:49 AM
I am trying to update a template in a gridview but it gaves me this error:
Unable to cast object of type 'System.Web.UI.WebControls.TextBox' to type 'System.IConvertible'.
Below is my code behind.
int
rowIndex = ((GridViewRow)((LinkButton)e.CommandSource).NamingContainer).RowIndex;
int
id = Convert.ToInt32(e.CommandArgument);
string
option = ((TextBox)GridView1.Rows[rowIndex].FindControl(
"TextBox1"
)).Text;
string
day = ((TextBox)GridView1.Rows[rowIndex].FindControl(
"TextBox2"
)).Text;
decimal
netpremium = Convert.ToDecimal(((TextBox)GridView1.Rows[rowIndex].FindControl(
"TextBox3"
)));
decimal
vat = Convert.ToDecimal(((TextBox)GridView1.Rows[rowIndex].FindControl(
"TextBox4"
)));
decimal
registry = Convert.ToDecimal(((TextBox)GridView1.Rows[rowIndex].FindControl(
"TextBox5"
)));
decimal
totalpremium = Convert.ToDecimal(((TextBox)GridView1.Rows[rowIndex].FindControl(
"TextBox6"
)));
TravelAssuranceDataAccess.UpdatePremium(id, option, day, netpremium, vat, registry, totalpremium);
GridView1.EditIndex = -1;
BindGridViewData();
Thanks in advance for any assistance.
Reply
Answers (
1
)
how to print 2 / 6 label in crystal report
How to add/remove columns at runtime in KendoGrid