उपयोग CustomDrawCell घटना तुम सिर्फ केवल पढ़ने के लिए सेल प्रदर्शित करने के लिए चाहते हैं। या आप CustomColumnDisplayText Event का भी उपयोग कर सकते हैं।
इस प्रयास करें:
private void gridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
{
if (e.Column.FieldName == "Marks")
{
e.DisplayText = (((int)(Convert.ToDecimal(e.CellValue) * 100))).ToString() + "%";
}
}
एक और तरीका संपादक EditFormat और DisplayFormat संपत्ति का उपयोग करें। रेफरी:: और सेट करने के बाद इन गुणों gridview स्तंभ में जोड़ने How to format values shown in the XtraGrid
RepositoryItem textEdit;
private void AddGridRepositoryItem()
{
textEdit = new RepositoryItemTextEdit();
textEdit.AllowHtmlDraw = DevExpress.Utils.DefaultBoolean.True;
textEdit.ReadOnly = true;
gridControl1.RepositoryItems.Add(textEdit);
textEdit.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
textEdit.DisplayFormat.FormatString = "p";
gridView1.Columns[0].ColumnEdit = textEdit;
}
सबसे आसान तरीका GridColumn.DisplayFormat संपत्ति का उपयोग करें।
colPayment.DisplayFormat.FormatType = FormatType.Numeric;
colPayment.DisplayFormat.FormatString = "p0";
आशा इस मदद ..
स्रोत
2012-05-21 10:48:55
वही है जो मैं खोज रहा था। सभी संदर्भों के लिए +1। – Stavros
अच्छा, और यह मुझे बाइट/tinyint के रूप में percents स्टोर करने की अनुमति भी - धन्यवाद! अन्यथा ग्रिडकंट्रोल डेटा की व्याख्या नहीं कर रहा था जैसा कि मैं चाहता था -> 10 प्रतिशत 1000% में बदल गया :) – Prokurors
पृथ्वी पर यह स्वीकार्य उत्तर क्यों है? – Aron