2011年3月18日 星期五

Jquery跟Silverlight打架!

最近工作上處理的系統中又有 silverlight又有 jQuery
結果兩個相處上有點小摩擦~銀光跟Jquery的遮罩互不相讓!
基本上調整 z-index沒有效果
後來找到一個解決方案~在嵌入SL的Object中加入兩個參數就完工!
<param name="background" value="Transparent" />    
                                <param name="windowless" value="true" />

高興了還沒三秒鐘!卻換 Drag and drop 的功能不能用了!昏 ...
Silverlight主要負責處理拖曳上傳。

後來發現最有影響的是<param name="windowless" value="true" />這一行
所以乾脆把它作成<Literal>控制項,由程式去控制他的true or false!
void SetWindowless(bool iswlmode)
    {
        StringBuilder sb = new StringBuilder();
        string wlmode = (iswlmode) ? "true" : "false";
        sb.AppendFormat("<param name=\"windowless\" value=\"{0}\" />",wlmode);
        Lit_windowless.Text = sb.ToString();
    }
--
<object data="data:application/x-silverlight-2," height="99%" type="application/x-silverlight-2"
                                width="350px" style="z-index:99999;">
                                <param name="source" value="/Service/xxx.xap" />
                                <param name="onError" value="onSilverlightError" />
                                <param name="minRuntimeVersion" value="4.0.50826.0" />
                                <%--<param name="background" value="Transparent" />    
                                <param name="windowless" value="true" />   --%>
                                <asp:Literal ID="Lit_windowless" runat="server" />               
                                <param name="autoUpgrade" value="true" />
                                <a href="http://go.microsoft.com/fwlink/?LinkID=149156&amp;v=4.0.50826.0" style="text-decoration: none">
                                    <img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight"
                                        style="border-style: none" />
                                </a>
                            </object>
利用完了再一腳踢開 ccc

--
看到、想到、說到、做到 
能夠填平大海的誓言,也比不上邁出一步的價值 
是以吾輩此生,再無任何誓言

2011年3月11日 星期五

VS應用程式伺服器∼自訂Port號備忘

VS應用程式伺服器∼自訂Port號備忘

--
看到、想到、說到、做到 
能夠填平大海的誓言,也比不上邁出一步的價值 
是以吾輩此生,再無任何誓言

2011年3月1日 星期二

動態載入User control

做一個按鈕來動態載入User control,按一次增加一個
必須在Postback後保留。在網路上找到章老師的文章參考後,利用Viewstate來解決
取出動態載入的uc 取其值進行運算儲存。

引用
<%@ Reference Control="~/UserControl/EFlow/EFlowConditional.ascx" %>

加減按鈕
        <asp:ImageButton ID="YTImgBut_cdtl_add" runat="server" ToolTip="增加條件式" ImageUrl="~/images/icon/list-add.png"
            OnClick="YTImgBut_cdtl_add_Click" />&nbsp;
        <asp:ImageButton ID="ImgBut_cdtl_Remove" runat="server" ImageUrl="~/images/icon/trash.gif"
            OnClick="ImgBut_cdtl_Remove_Click" />
容器
<asp:PlaceHolder ID="PlaceHolder_cdtl1" runat="server"></asp:PlaceHolder>

新增時ViewState遞增
protected void YTImgBut_cdtl_add_Click(object sender, EventArgs e)
        {
            ViewState["DesignerMode"] = "Add";
            if (ViewState["cdtlID"] == null) ViewState["cdtlID"] = 1;
            else ViewState.Add("cdtlID", Convert.ToInt32(ViewState["cdtlID"]) + 1);
            SetUserControl(ViewState["cdtlID"].ToString());
        }

poskback回來後要如數加回
 if (IsPostBack)
            {
                SetUserControl();
                int ci = 0;
                if (int.TryParse(ViewState["cdtlID"].ToString(), out ci))
                {
                    for (int i = 1; i <= ci; i++)
                    {
                        SetUserControl(i.ToString());
                    }
                }
            }
            else
            {
                ViewState["DesignerMode"] = "Init";
                ViewState["cdtlID"] = 0;
                SetUserControl();

                for (int i = 1; i <= _SelectCount - 1; i++)
                {
                    ViewState["DesignerMode"] = "Add";
                    ViewState.Add("cdtlID", Convert.ToInt32(ViewState["cdtlID"]) + 1);
                    SetUserControl(i.ToString());
                }
            }

動態取值
 if (int.TryParse(ViewState["cdtlID"].ToString(), out ci))
            {
                for (int i = 0; i <= ci; i++)
                {
                    string controlid = string.Format("yt_eflw_ctdl_{0}", i.ToString());
                    UserControl_EFlow_EFlowConditional cdtl;
                    if (i == 0) cdtl = (UserControl_EFlow_EFlowConditional)PlaceHolder_cdtl0.FindControl(controlid);
                    else cdtl = (UserControl_EFlow_EFlowConditional)PlaceHolder_cdtl1.FindControl(controlid);
                    string n = cdtl.ConditionalName;
                    int sch = cdtl.ConditionalSch;
                    string fd = cdtl.ConditionalField;
                    string lg = cdtl.ConditionalLogi;
                    string v = cdtl.ConditionalValue;
                    string flid = cdtl.FlowID;
                    bool en = cdtl.IsEnable;
                    if (SaveConfig(_FormID, n, sch, fd, lg, v, flid, en)) i_ok++;
                    i_all++;
                }
p.s.注意to me (textbox)不要用到yt版!!
--
看到、想到、說到、做到 
能夠填平大海的誓言,也比不上邁出一步的價值 
是以吾輩此生,再無任何誓言