Click here to Skip to main content
15,884,921 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my database the result column of a table is single. In datagridview, I to Convert Columns to string so the user can Enter a result or a char as a code that means something to program. So how can I convert a column of a datagridview?
Posted
Comments
TweakBird 25-Feb-11 10:51am    
Not Clear? Can you provide more details like put some code or what you have tried.?

1 solution

use template field for data conversion like this
<asp:templatefield headertext="Bill Amount">
      <itemtemplate>
              <asp:label id="lblBillAmt" runat="server" text="<%#Convert.ToDouble( Eval("BillAmt")).ToString("#0.00")%>">
      </itemtemplate>
      <edittemplate>
              <asp:textbox id="txtBillAmt" runat="server" text="<%#Convert.ToDouble( Eval("BillAmt")).ToString("#0.00")%>">
      </edittemplate>
      <itemstyle horizontalalign="Right" />
<asp:templatefield>
 
Share this answer
 
v3
Comments
siaswar 26-Feb-11 8:08am    
what is this? any easier way plz
pankajupadhyay29 26-Feb-11 12:22pm    
it is just aspx page code for data binding you might be familiar with this if u ever use custom columns. When you add bound fields from editor then use convert it to template field and check markup for these both you can easily understand the concept.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900