We have built our control (part 1, part 2, part 3, part 4) and now there is time to check it. Drag and drop on the WF_ListBoxes form our control (ListBoxesFT_C1) , three button controls (ButtonBack with the text "Back", ButtonJust with the text "PostBack" and ButtonTestDTOut with the text "Test DT_Out") and GridViewTestDT_Out (fig. 4).
With the help of the ButtonBack we "redirect" our test page to the previous page. With the help of the ButtonJust we just "force to work" the PostBack event and, thus, have an opportunity to check up "behaviour" of the control. With the help of the ButtonTestDTOut and the GridViewTestDT_Out we check up "output" of our control (C_DataOut).
The code of the WF_ListBoxes is very simple:
public partial class WebForms_Test_WF_ListBoxes : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
GetData.GetDataHelp getData = new GetData.GetDataHelp();
//ListBoxesFT_C1.C_Client = false;
//ListBoxesFT_C1.C_SortBy = 0;
//ListBoxesFT_C1.C_HeightLB = 200;
//ListBoxesFT_C1.C_WidthLB = 200;
//ListBoxesFT_C1.C_SortByText = false;
//ListBoxesFT_C1.C_LabelTo = "To";
protected void ButtonBack_Click(object sender, EventArgs e)
protected void ButtonTestDTOut_Click(object sender, EventArgs e)
GridViewTestDT_Out.DataSource = ListBoxesFT_C1.C_DataOut;
Now , for example , if your team leader chooses your control for checking up (fig. 5),
he gets the following (fig 6.):
He selects some items and clicks on the "Test DT_Out". The result is the following (fig. 7):
He clicks on the "PostBack"! All is OK. He asks to change the C_Client property to "false" , the C_SortBy property to "0", the C_HeightLB and C_WidthLB properties to "200". He selects the same items and gets the result (fig. 8):
OK! Your boss is satisfied by your work and authorizes to apply the control!
You can show the initiative and add such properties as : "C_Multiple" ,that allows to set selection mode of the ListBoxes to "multiple" ; "C_Validation", that allows to validate selected items with the help of a control (RangeValidator), added to the ListBoxesFT_C ; "C_Default", that allows to set default selected items ; etc.
We have built the control with the help of "clear server" and "clear client" technology. Such new features of ASP.Net 2.0 as the ICallbackEventHandler interface we will discuss in the next article.
I hope that this article will help you to recreate and test the ListBoxesFT_C control or to create and test your own web user control with your own requests in Visual Studio 2005.
Good luck in programming !