Note that there are some explanatory texts on larger screens.

plurals
  1. PODifference between asp.net label text elements and ordnary text
    text
    copied!<p>I have a doubt </p> <p>What is the Different between these labels for putting the element text ?</p> <pre><code> &lt;asp:Label ID="lbl2" **Text="Name"** runat="server"&gt;&lt;/asp:Label&gt; </code></pre> <p>and</p> <pre><code> &lt;asp:Label ID="lbl2" runat="server"**&gt;Name&lt;/**asp:Label&gt; </code></pre> <p>For straightly put the text in text property <code>Text="Name"</code> and put the text on center of the label field <code>&gt; Name &lt;/</code></p> <p>I have some labels on my gridview controls , I want to get the label text value in when i edit the grid row, So i use find control like</p> <pre><code>*protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) { Label xx = GridView1.Rows[e.NewEditIndex].FindControl("lbl2") as Label; Label yy = GridView1.Rows[e.NewEditIndex].FindControl("lbl2") as Label; txtName.Text = xx.Text; txtAge.Text = yy.Text; }* </code></pre> <p>Her is my gridview code</p> <pre><code> &lt;asp:TemplateField HeaderText="Name"&gt; &lt;ItemTemplate&gt; &lt;asp:Label ID="lbl1" Text='&lt;%# Eval("StudentName") %&gt;' runat="server"&gt;&lt;/asp:Label&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; </code></pre> <p>If i put the Eval value in label Text property ,Now working , But if i Give the eval values in center of the label side( <code>&lt;asp:Label ID="lbl1" runat="server"&gt;&lt;%# Eval("StudentName") %&gt;&lt;/asp:Label&gt;</code>) the find control not get the values ,It's display empty ("") . Why ?</p> <p>what is the difference between this label text type ? Any one please advice to me !</p> <p><strong>Edit:</strong></p> <blockquote> <p>But if I set the label text in outside of gridview , both of way's are working good(lblid.text give correct if set the text in that two way ) ! only i got the problem in label inside of gridview !</p> </blockquote>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload