后台Attributes.Add

Attributes.Add
 DropDownList dropWLLBID = (DropDownList)this._page.FindControl("val_WLLBID");
            if (dropWLLBID != null)
            {
                dropWLLBID.Attributes.Add("style", "height:25");             
                dropWLLBID.SelectedIndexChanged += new EventHandler(this.dropWLLBID_SelectedIndexChanged);
                dropWLLBID.AutoPostBack = true;
            }

 if (button != null)
                        {
                            button.Attributes.Add("onclick", "javascript:return confirm('确定要将数据删除吗?');");
                        }

 protected void message_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            LinkButton dele = (LinkButton)(e.Item.FindControl("DelButton"));
            if (dele != null)
            {
                dele.Attributes.Add("onclick", "return confirm('确定删除吗?')");
            }
        }

if ((width - 15) == 0)
            {
                base.Attributes.Add("style", "visibility:hidden");
            }
            else
            {
                base.Attributes.Add("style", "width:" + Convert.ToString(width - 15) + "px");

 for (int i = 0; i < index; i++)
                {
                    TextBox tb = g.GetTextBoxInGridCell(i, "yy");
                    tb.Attributes.Add("onkeydown", "if(event.keyCode==13){document.all." + btnhc.ClientID + ".click();return false;}");
                }

using Salien.Utility.SUWF;
using System.Web.UI.WebControls;

namespace WXSMMJ
{
    public class Cls后台注册脚本 : ISuwfBus
    {
        private SlnSuwfPage _page;
        public void Initial(SlnSuwfPage page)
        {
            _page = page;
            _page.afterFillGrid += onAfterFillGrid;
        }  
            private void onAfterFillGrid()
            {
             RegisterShowhistory(_page.Page.Response);
            return;
            }
            private void AddShowRecord(TableCell cell, string types, string targetID)
            {
                if (cell == null || string.IsNullOrEmpty(types) || string.IsNullOrEmpty(targetID)) return;
                cell.BackColor = System.Drawing.Color.Gold;
            string GroupID = "";
                string js = string.Format(@"javascript:showhistory('{0}','{1}','{2}')", targetID, types, GroupID);
                cell.Attributes.Add("ondblclick", js);
            }

            private void RegisterShowhistory(System.Web.HttpResponse response)
            {
                if (response != null)
                {
                    string strScript = @"<script>function showhistory(tid,type,gid){openWin(""CommPage.aspx?pu=100396&targetid=""+tid+""&u_type=""+type+""&groupid=""+gid);}</script>";
                    response.Write(strScript);
                }
            }
        }
    }

 

posted @ 2025-08-21 14:11  知行一体2  阅读(6)  评论(0)    收藏  举报