简体   繁体   中英

how to pass textbox value to @“somestring”

 string htmlPage = @"<div class=""wecome"" id=""about"">        
                      <h3>Welcome "+TexName.Text+"</h3> 
                    </div>";

I want to pass texbox value to textbox.text.

<asp:TextBox ID="TexName" runat="server"></asp:TextBox>

I am using @ because htmlpage variable contains almost 400 lines of html code. Without @ it is giving syntax errors.

try this

   string htmlPage = @"<div class=" + "\"wecome\"" + " id=" + "\"about\"" + ">" +
                       "<h3>Welcome " + TexName.Text + "</h3>" +
                     "</div>";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM