c# - Gridview text changed event -


i calculating total of gridview price field values textbox in textboxchanged event of gridview. while cursor coming line: total +=convert.todecimal(mytextbox); getting exception: input string not in correct format. here gridviewtext changed event code:

protected void txtprice_ontextchanged(object sender, system.eventargs e) {     decimal total = 0.0m;     foreach (gridviewrow gvr in grdtabrow.rows)      {         if (gvr.rowtype == datacontrolrowtype.datarow)         {             textbox tb = gvr.findcontrol("txtprice") textbox;             string mytextbox = tb.tostring();             if (!mytextbox.equals("") && mytextbox != null)             {                 total +=convert.todecimal(mytextbox);             }         }         grdtabrow.footerrow.cells[2].text = total.tostring();     }   } 

try:

string mytextbox = tb.text.tostring(); total += convert.todecimal(mytextbox); 

tostring() believe returns objects representation differs between objects , doesn't reprsent specific value of object. return full qualified name of object.the text member returns value of textbox. tostring() should optional


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -