本文介绍了如何解决此问题意外语法错误:意外标记}(重复次数)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 在Header.ascxIn Header.ascx<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Header.ascx.cs" Inherits="SchoolManagementSystem.Root.Control_Master.Header" %><link href="../../Css/style.css" rel="stylesheet" /><link href="../../Css/gallary/venobox.css" rel="stylesheet" /><script type="text/javascript"> function changeLanguage(obj) { debugger; $.ajax({ type: "POST", url: "Header.ascx/resourceString", data: "{StrId:" + obj + "}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (result) { alert('Method Called Sucess fully'); }, error: function (result) { alert("error " + result); } }); }</script><div class="header_main"> <div class="header_top_main"> <div class="header"> <div class="header_left"> <%--For any assistance call: 1234567890--%> <%=schoolManagemetBL.ClsCommon.GetLocaleResourceString("Front.Header.ForAny")%>: 1234567890 </div> <div class="header_right"> <div class="social_icon"> <a href="https://www.facebook.com"> <img src="../../images/facebook.png" alt="" style="margin: 0px 5px 0px 5px; width: 30px;" /></a> <a href="https://twitter.com"> <img src="../../images/twitter.png" alt="" style="margin: 0px 5px 0px 5px; width: 30px;" /></a> <a href="https://plus.google.com"> <img src="../../images/googleplus.png" alt="" style="margin: 0px 5px 0px 5px; width: 30px;" /></a> <asp:Literal ID="ltrlLanguageImage" runat="server"></asp:Literal> <%--<asp:DropDownList ID="ddlLanguage" runat="server"></asp:DropDownList>--%> </div> <div class="header_left"> <asp:Label ID="lblvisitcount" runat="server" Text="Visitors :"></asp:Label> <asp:Literal ID="ltshowcount" runat="server"></asp:Literal> </div> <asp:Label ID="lblUser" runat="server"></asp:Label> <asp:Label ID="lblUser1" runat="server"></asp:Label> <a href="../../Registration.aspx" cssclass="student_login_button"> <asp:Label ID="Label2" runat="server" CssClass="student_login_button">|</asp:Label> <asp:Label ID="Label1" runat="server" Text="Sign Up" CssClass="student_login_button"></asp:Label> </a> </div> <div class="clear"></div> </div> </div> <div class="header"> <div class="header_left"> <a href="../Index.aspx"> <img src="../../images/logo.png" alt="Logo" /></a> </div> <div class="header_right" style="width: 71%;"> <div class="navigation"> <ul id="nav"> <%--<li><a href="../../Index.aspx">Home</a></li>--%> <li><a href="../../Index.aspx"><%=schoolManagemetBL.ClsCommon.GetLocaleResourceString("Front.HeaderMenu.Home")%></a></li> <%--<li><a href="AboutBFIT.aspx">About</a>--%> <li><a href="../../Index.aspx"><%=schoolManagemetBL.ClsCommon.GetLocaleResourceString("Front.HeaderMenu.About")%></a></li> <ul> <li><a href="AboutBFIT.aspx">About BFIT</a></li> <li><a href="MissionVision.aspx">Mission & Vision</a></li> <%-- <li><a href="#">Our Vision</a></li>--%> <%-- <li><a href="AimsAchivment.aspx">Aims & Achievement </a></li>--%> <li><a href="DirectorMessage.aspx">Director Message</a></li> <li><a href="#">Chairman Message</a></li> <li><a href="#">Organization Certification</a></li> <li><a href="#" class="last">ISO 9001:2008 Certified</a></li> </ul> <%-- </li>--%> <%-- <li><a href="../../Course.aspx">Courses</a></li> <li><a href="../../Center.aspx">Our Centers</a></li> <li><a href="../../GalleryMain.aspx">Gallery</a></li> <li><a href="../../Placement.aspx">Placement</a></li> <li><a href="../../ApplicationForm.aspx">Franchisee</a></li> <li><a href="../../Contact.aspx">Contacts Us</a></li>--%> <li><a href="../../Index.aspx"><%=schoolManagemetBL.ClsCommon.GetLocaleResourceString("Front.HeaderMenu.OurCenters")%></a></li> <li><a href="../../Index.aspx"><%=schoolManagemetBL.ClsCommon.GetLocaleResourceString("Front.HeaderMenu.Gallery")%></a></li> <li><a href="../../Index.aspx"><%=schoolManagemetBL.ClsCommon.GetLocaleResourceString("Front.HeaderMenu.Placement")%></a></li> <li><a href="../../Index.aspx"><%=schoolManagemetBL.ClsCommon.GetLocaleResourceString("Front.HeaderMenu.Franchisee")%></a></li> <li><a href="../../Index.aspx"><%=schoolManagemetBL.ClsCommon.GetLocaleResourceString("Front.HeaderMenu.ContactUs")%></a></li> </ul> </div> </div> </div> <div class="clear"></div> <div class="border"></div></div> Coding Part-:Coding Part-:protected void FillLangImage(){ try { StringBuilder sb = new StringBuilder(); List<sp_fetchAllLanguage_Result> lstLanguage = new List<sp_fetchAllLanguage_Result>(); lstLanguage = objClsLang.GetAllLanguage(); if (lstLanguage.Count > 0) { foreach (var image in lstLanguage) { //<img src="../../images/googleplus.png" alt="" style="margin: 0px 5px 0px 5px; width: 30px;" /> //sb.Append("<a href='https://plus.google.com'>"); //sb.Append("<a id='click' runat='server' onclick='changeLanguage('"+ID+"');' href='#'>"); sb.Append("<a id='click' runat='server' onclick='changeLanguage('" + image.ID + "');' href='#'>"); sb.Append("<img src= ' " + image.Flag + " ' alt='' title= " + image.Name + " style ='margin: 0px 5px 0px 5px; width: 20px;'/>"); sb.Append("</a>"); } } ltrlLanguageImage.Text = sb.ToString(); } catch (Exception ex) { }}[WebMethod] public static void resourceString( int StrId) { ClsCommon.GetLocaleResourceString(""); }推荐答案 Coding Part-:Coding Part-:protected void FillLangImage(){ try { StringBuilder sb = new StringBuilder(); List<sp_fetchAllLanguage_Result> lstLanguage = new List<sp_fetchAllLanguage_Result>(); lstLanguage = objClsLang.GetAllLanguage(); if (lstLanguage.Count > 0) { foreach (var image in lstLanguage) { //<img src="../../images/googleplus.png" alt="" style="margin: 0px 5px 0px 5px; width: 30px;" /> //sb.Append("<a href='https://plus.google.com'>"); //sb.Append("<a id='click' runat='server' onclick='changeLanguage('"+ID+"');' href='#'>"); sb.Append("<a id='click' runat='server' onclick='changeLanguage('" + image.ID + "');' href='#'>"); sb.Append("<img src= ' " + image.Flag + " ' alt='' title= " + image.Name + " style ='margin: 0px 5px 0px 5px; width: 20px;'/>"); sb.Append("</a>"); } } ltrlLanguageImage.Text = sb.ToString(); } catch (Exception ex) { }}[WebMethod] public static void resourceString( int StrId) { ClsCommon.GetLocaleResourceString(""); } 这篇关于如何解决此问题意外语法错误:意外标记}(重复次数)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-16 02:29