Make a Multiline label in Asp.Net
Hi Firends,
In this post , I am explaining you how to make a multiline lable in Asp.net.
This code help us for set a label value multiline .
Lets take an example that we have a label having ID lbl_Text now just write the code
string value=””;
string final_result;
for (int i = 0; i < 10; i++)
{
value=value+”Demo”+ Environment.NewLine;
final_result=value.Replace(Environment.NewLine, "
");
}
lbl_Text.Text= final;
// If you want to set label property dynamically Use this
protected void btn_click_Click(object sender, EventArgs e)
{
lbl_Name.Text = "Rajesh";
lbl_Name.BackColor = System.Drawing.Color.Red;
lbl_Name.ForeColor = Color.Black;
lbl_Name.Font.Bold = false;
lbl_Name.Font.Italic = false;
lbl_Name.Font.Underline = true;
lbl_Name.BorderColor = Color.White;
lbl_Name.BorderStyle = BorderStyle.Solid;
lbl_result.Text = lbl_Name.Text;
}
In this post , I am explaining you how to make a multiline lable in Asp.net.
This code help us for set a label value multiline .
Lets take an example that we have a label having ID lbl_Text now just write the code
string value=””;
string final_result;
for (int i = 0; i < 10; i++)
{
value=value+”Demo”+ Environment.NewLine;
final_result=value.Replace(Environment.NewLine, "
");
}
lbl_Text.Text= final;
// If you want to set label property dynamically Use this
protected void btn_click_Click(object sender, EventArgs e)
{
lbl_Name.Text = "Rajesh";
lbl_Name.BackColor = System.Drawing.Color.Red;
lbl_Name.ForeColor = Color.Black;
lbl_Name.Font.Bold = false;
lbl_Name.Font.Italic = false;
lbl_Name.Font.Underline = true;
lbl_Name.BorderColor = Color.White;
lbl_Name.BorderStyle = BorderStyle.Solid;
lbl_result.Text = lbl_Name.Text;
}
all d best
ReplyDelete