ASP.NET - label text with multiple eval - Asked By hiral jani on 15-Apr-10 02:33 AM

Hello,


I need to create label wherein the text attribute should consist of dabasefields1, "(" , databasefields2 , ")"
I am using eval for getting the database field but am not sure how to call all this in 1 text property.
Suggestions appreciated
Anand Malli replied to hiral jani on 15-Apr-10 02:42 AM

This is simple you can do it from your code itself by doing following,say you have DataTable called "dtRecord"

so you can do following


string strAllField="( ,";
for(int colCount=0;colCount<dtRecord.Columns.count;colcount++)
{
      
    strAllField += dtRecord.Rows[0][colCount].ToSTring() + ",";
}
strAllField +=" ) ";
  
lblText.Text=strAllFields;


and you are done thxs hiral

thxs
Santhosh N replied to hiral jani on 15-Apr-10 02:49 AM
You could have a string varaiable and assign thr values from db to that..

DataReader dr...


string str = dr[0].ToString() + "(" + dr[1].ToString() + ")" ;

hiral jani replied to Santhosh N on 15-Apr-10 11:49 PM
Kindly note that its not in the .cs file its in .aspx page so I cant use datatable or datareader