Hello, I am trying to use this code, but for some reason it does not work. Actually need help with this. The problem is that the label does not change the name from the "label" when entering the site.
<asp:Label ID="Label1" runat="server" Text="label"></asp:Label> <% Label1.Text = "test"; if (Request.QueryString["ID"] != null) { string test = Request.QueryString["ID"]; Label1.Text = "Du har nu lånat filmen:" + test; } %>
you should convert the type of test → → test.tostring ();
change the last line as follows:
Label1.Text = "Du har nu lånat filmen:" + test.tostring();
Have you tried to run the code in the Page_Load () method?
protected void Page_Load(object sender, EventArgs e) { Label1.Text = "test"; if (Request.QueryString["ID"] != null) { string test = Request.QueryString["ID"]; Label1.Text = "Du har nu lånat filmen:" + test; } }
, , , "text" , "content".
:
Label output = null; output = Label1; output.Text = "hello";
Label output = null; output = Label1; output.Content = "hello";
An old question, but I also had this problem, so after assigning the Text property, the call Refresh()will update the text.
Refresh()
Label1.Text = "Du har nu lånat filmen:" + test; Refresh();
When I had this problem, I could only see part of my text, and this is the solution for this:
Be sure to set the AutoSize property to true.
output.AutoSize = true;
Label label1 = new System.Windows.Forms.Label //label1.Text = "test"; if (Request.QueryString["ID"] != null) { string test = Request.QueryString["ID"]; label1.Text = "Du har nu lånat filmen:" + test; } else { string test = Request.QueryString["ID"]; label1.Text = "test"; }
It should do it
Source: https://habr.com/ru/post/1747257/More articles:What is an event in C #? - c #Events in C # - Definition and Example - c #Как метаданные maven buildNumber становятся непоследовательными для нескольких агентов сборки? - maven-2TortoiseSvn Merge, за которым следует Create Patch, не включает новые файлы - mergeFriendly URLs in Google App Engine - pythonHow can I do daily backups for my VisualSVN repositories? - svnRunning batch file with parameters in Python OR F # - pythonOpen XMLHttpRequest Method - xmlCreate a JSONpath expression so that it retrieves only a specific value? - jsonGet data from XDocument - c #All Articles