Skip to main content

Posts

Showing posts from July, 2007

BizTalk notes

To quick (close to useless) guide to create biz transformation solution in BizTalk Server.

Define Schema ---> Define Messages --> Map Message to Schema
--> Perform Message Transformation and operations ---> Setup your project file --> Create your snk ---> Deploy from V Studio --> Configure your project accordingly in BizTalk

*Create all your schema and messages first* Things can get easier.

Custom Server Controls Vs Entirely Custom Controls

Sometimes you find yourself writing custom controls which uses server control provided by Microsoft.

These controls include TextBox, GridView and Button. With these control you don't have to implement IPostBackDataHandler (unless you're doing something customization) as you can wire the event shown here.

protected override void CreateChildControls()
{

base.CreateChildControls();

_txtBox = new TextBox();
this.Controls.Add(_txtBox);

_txtBox.Text = _defaultText;

System.Web.UI.WebControls.Button _txtBtn = new Button();
this.Controls.Add(_txtBtn);

_txtBtn.Click += new EventHandler(_txtBtn_Click);
_txtBtn.Text = _cmdText;

}

void _txtBtn_Click(object sender, EventArgs e)
{

////// triggerring take place here /////////

}


If you need to customized your control above to implement IPostBackDataHandler for your custom server control, then just register your component. Beware if you do that, …

WebPart - UserControl Loaded Multiple Times and GridView Event not Triggerd

Creating user control declaratively in your WebPart won't give your alot of problem. But when you try to load pro grammatically a user control (ascx) into your webparts using something like this:-

Your WebPartPage

Control uc = this.LoadControl(@"webparts\CompanyNews.ascx");
uc.ID = "webPartyMan";
GenericWebPart wp2 = wp.CreateWebPart(uc);
wp.AddWebPart(wp2, LeftZone, 1);

You found that you loaded it multiple times and somethings GridView events are not triggered.
What the trick?

You only load your ascx once (you won't load it ever again) and right after you dynamically load it call SetPersonalizationDirty(); This is done using your custom WebPartManager;

This is a very simplified version of your custom webPartManager (loadPersonalizationBlob and savePersonalizationBlob)

namespace CoreWebPart
{
public class myWebPartManager : WebPartManager
{

public void SetDirty()
{
SetPersonalizationDirty();
}
}

} ///// end namespace


Then your we…