当前位置: 首页>>代码示例>>C#>>正文


C# HtmlImage.ResolveClientUrl方法代码示例

本文整理汇总了C#中System.Web.UI.HtmlControls.HtmlImage.ResolveClientUrl方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlImage.ResolveClientUrl方法的具体用法?C# HtmlImage.ResolveClientUrl怎么用?C# HtmlImage.ResolveClientUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.UI.HtmlControls.HtmlImage的用法示例。


在下文中一共展示了HtmlImage.ResolveClientUrl方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoadTeachers

        private void LoadTeachers()
        {
            if(_selectedClass.Teachers.Count == 0) _selectedClass.LoadTeachers();

            HtmlImage summaryImage = new HtmlImage();
            summaryImage.Src = "~/Images/summary.png";
            string summaryImageSrc = summaryImage.ResolveClientUrl(summaryImage.Src);

            HyperLink teacherOnclickLink = new HyperLink();
            string teacherOnclickLinkString;
            teacherOnclickLink.NavigateUrl = "~/Record/Teacher.aspx?childPage=yes&xID=";
            teacherOnclickLinkString = teacherOnclickLink.ResolveClientUrl(teacherOnclickLink.NavigateUrl);

            foreach (Thinkgate.Base.Classes.Teacher teacher in _selectedClass.Teachers)
            {
                HtmlTableRow newRow = new HtmlTableRow();
                HtmlTableCell cell1 = new HtmlTableCell();
                string xID = Encryption.EncryptInt(teacher.PersonID);

                if (UserHasPermission(Permission.Hyperlink_Teacher_ClassSummaryExpanded))
                {
                    /* User has permission so display Teacher Name as hyperlink. */
                    cell1.InnerHtml = "<img src=\"" + summaryImageSrc + "\" class=\"summaryImgButton\" style=\"display:none; cursor:pointer; margin-right:5px;\"/><a href=\"javascript:void();\" onclick=\"window.open('" +
                        teacherOnclickLinkString + xID + "'); return false;\">" + teacher.FirstName + " " + teacher.LastName + "</a> " + (teacher.IsPrimary ? "(Primary)" : "");
                }
                else
                {
                    /* User does not have permission so display Teacher Name as label. */
                    cell1.InnerHtml = "<img src=\"" + summaryImageSrc + "\" class=\"summaryImgButton\" style=\"display:none; cursor:pointer; margin-right:5px;\"/><label>" + 
                                      teacher.FirstName + " " + teacher.LastName + "</label> " + (teacher.IsPrimary ? "(Primary)" : "");
                }

                newRow.Cells.Add(cell1);
                teachersTable.Rows.Add(newRow);
            }

            teachersTable.DataBind();
        }
开发者ID:ezimaxtechnologies,项目名称:ASP.Net,代码行数:38,代码来源:ClassSummary_Expanded.aspx.cs


注:本文中的System.Web.UI.HtmlControls.HtmlImage.ResolveClientUrl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。