奇怪的为题?
同一个事件用不同的控件进行触发,结果不一样,事件是脚本事件从模态窗口取回一个值,然后触发后台事件给控件赋值,设置断点跟踪发现控件在后台都被赋值了!然而到前台发现,用txtbox引发脚本的时候,可以控件显示刚才的赋值,然而用imgbutton引发的时候却,控件依然是空白的!
代码:
<asp:TextBox ID= "Person_IDTxt " runat= "server " Width= "280px " Length= "20 " onclick= "return showmodule(); "> </asp:TextBox>
<asp:ImageButton ID= "SearchIbtn " runat= "server " ImageUrl= "~/Images/view.gif " OnClientClick= "return showmodule(); "/>
<asp:Button ID= "BindBtn " CssClass= "hideControl " runat= "server " OnClick= "BindBtn_OnClick "
CausesValidation= "false " />
脚本:
<script language= "javascript ">
function showmodule()
{
var Person_ID= window.showModalDialog( "DrugReceivePerson.aspx ", 'popupWindow ', "dialogWidth:450px;dialogHeight:490px; ");
if(Person_ID!=null &&Person_ID!= " " )
{
document.getElementById( 'HFPerson_ID ').value=Person_ID;
document.getElementById( "BindBtn ").click();
}
else
{
}
}
</script>
后台:
public void BindBtn_OnClick(object sender, EventArgs e)
{
try
{
if (Convert.ToString(HFPerson_ID.Value) != null && Convert.ToString(HFPerson_ID.Value) != " ")
{
Person_ID = Convert.ToInt32(HFPerson_ID.Value);
dt = MySearchPerson.PersonInfo_GetNameByPersonID(Person_ID);
foreach (System.Data.DataRow row in dt.Rows)
{
Person_IDTxt.Text =