本文介绍了PopupControlExtender.TargetCon ...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

TargetControlID是按钮.但是我想提交到文本框.
我应该怎么写?

TargetControlID of PopupControlExtender is button. But I want to commit to textbox.
How should I write it? Please?

推荐答案

<ajax:PopupControlExtender ID="PopupControlExtender1" runat="server"

               PopupControlID="Panel1"

               TargetControlID="Image1"

               DynamicContextKey='<%# Eval("ProgrammeID") %>'

               DynamicControlID="Panel1"

               DynamicServiceMethod="GetDynamicContent" Position="Bottom">
            </ajax:PopupControlExtender>

<script runat="server">
 [System.Web.Services.WebMethod(), System.Web.Script.Services.ScriptMethodAttribute()]
  
    public static string GetDynamicContent(string contextKey)
    {
 
        string constr = "Data Source=SAYAN-PC;Initial Catalog=nayuma;Trusted_connection=false;Integrated Security=false;User Id=sa;Password=lock;";
        string query = "SELECT Context FROM ProgrammeSchedule WHERE ProgrammeID = " + contextKey;

        System.Data.SqlClient.SqlDataAdapter da = new System.Data.SqlClient.SqlDataAdapter(query, constr);
        System.Data.DataTable table = new System.Data.DataTable();

        da.Fill(table);

        StringBuilder b = new StringBuilder();

        b.Append("<table style="background-color:#f3f3f3; border: #2A2A2A 3px solid; ");<br mode="hold" />        b.Append("width:280px; font-size:10pt; font-family:Verdana;" cellspacing="0" cellpadding="3">");

        b.Append("<tr><td colspan="3" style="background-color:#2A2A2A; color:white;">");
        b.Append("Context"); b.Append("</td></tr>");
        b.Append("<tr><td style="width:80px;">Details</td>");


        b.Append("<tr>");
        b.Append("<td>" + table.Rows[0]["Context"].ToString() + "</td>");

        b.Append("</tr>");

        b.Append("</tr></table>");

        return b.ToString();
    }
</script>


这篇关于PopupControlExtender.TargetCon ...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 07:40