Problem with Web User Control

G

Guest

I have one web user Control "AddressType.ascx". This is used mainly to add
new records.The control have two buttons named cmdSave and cmdCancel and a
TextBox named txtAddressType. The code for cmdSave is as follows

int iNewID;
using(AddressType oBFAddressType = new AddressType())
{
try {
iNewID=oBFAddressType.AddAddressType(txtAddressType.Text);
}
catch(Exception ex)
{
object oCntxHandler = Context.Handler;
System.Type typCntx = Context.Handler.GetType();
PropertyInfo pinfoErrMsg = typCntx.GetProperty("ErrMsg");
pinfoErrMsg.SetValue(oCntxHandler, ex.Message, null);
}
}

The code will add new address type and returns error by stored procedure if
address type already exists. The parent page has ErrorMsg property which
displays Error Message in Label Control.This property value is set from web
user control using reflection as shwon above.

I have added this control runtime in PlaceHolder as

phEditData.Controls.Add(LoadControl("AddressType.ascx"));

When I click on cmdSave of web user control and error get raised from
stored procedure the title of IE window running parent page disappears. The
parent page is open by using Window.ShowModelDialog method using javascript.

I want to display same title in title bar of window and error description in
lblErrorMessage control.

Please let me know how to over come this problem and why it happend.

Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top