tag:blogger.com,1999:blog-47930694453318111472024-03-13T11:13:06.825-07:00.Net Candymonahttp://www.blogger.com/profile/06677854988036291962noreply@blogger.comBlogger9125tag:blogger.com,1999:blog-4793069445331811147.post-81197836728329673562010-02-05T17:57:00.000-08:002010-02-06T03:40:58.884-08:00When HttpContext.Current.Request.PhysicalApplicationPath is Null<span style="font-size:130%;">Well this is gonna be a simple Post ,have you ever tried to Get the Application Physical Path using </span><span style=";font-size:130%;color:blue;" > HttpContext.Current.Request.PhysicalApplicationPath </span><span style="font-size:130%;">and in return you got a Null Reference Exception? Because HttpContext.Current retruns Null, then </span><span style=";font-size:130%;color:blue;" >System.Web.Hosting.HostingEnvironment.MapPath</span><span style="font-size:130%;"> is where you should go, you give it a virtual Path and it returns the equivalent Physical Path.</span>monahttp://www.blogger.com/profile/06677854988036291962noreply@blogger.com0tag:blogger.com,1999:blog-4793069445331811147.post-80553733700218950062008-11-05T06:25:00.000-08:002008-11-07T15:29:20.185-08:00employees and business meetings<span style="color: rgb(0, 0, 0);font-size:100%;" ><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiY2LzSRfckrE6oOn2IqyRjVKWL4tC4TJPB9DOCyk81VVE4Q90U9TGDQwbiCZjPVWqxYtDiSUHIfilfJ1NG-CFNbkeAQjwDWHDKUzvLR9SAJ30r0aqUNgyWBf1kDqSMRBwoSAk9mYB7z6aZ/s1600-h/jkn0105l.jpg"><img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 333px; height: 400px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiY2LzSRfckrE6oOn2IqyRjVKWL4tC4TJPB9DOCyk81VVE4Q90U9TGDQwbiCZjPVWqxYtDiSUHIfilfJ1NG-CFNbkeAQjwDWHDKUzvLR9SAJ30r0aqUNgyWBf1kDqSMRBwoSAk9mYB7z6aZ/s400/jkn0105l.jpg" alt="" id="BLOGGER_PHOTO_ID_5265931698766091586" border="0" /></a></span><link style="font-family: arial; color: rgb(0, 0, 0);" rel="themeData" href="file:///C:%5CUsers%5CMona%5CAppData%5CLocal%5CTemp%5C1%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx"><link style="font-family: arial; color: rgb(0, 0, 0);" rel="colorSchemeMapping" href="file:///C:%5CUsers%5CMona%5CAppData%5CLocal%5CTemp%5C1%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml"><!--[if gte mso 9]><xml> <w:worddocument> <w:view>Normal</w:View> <w:zoom>0</w:Zoom> <w:trackmoves/> <w:trackformatting/> <w:punctuationkerning/> <w:validateagainstschemas/> <w:saveifxmlinvalid>false</w:SaveIfXMLInvalid> <w:ignoremixedcontent>false</w:IgnoreMixedContent> <w:alwaysshowplaceholdertext>false</w:AlwaysShowPlaceholderText> <w:donotpromoteqf/> <w:lidthemeother>EN-US</w:LidThemeOther> <w:lidthemeasian>X-NONE</w:LidThemeAsian> <w:lidthemecomplexscript>AR-SA</w:LidThemeComplexScript> <w:compatibility> <w:breakwrappedtables/> <w:snaptogridincell/> <w:wraptextwithpunct/> <w:useasianbreakrules/> <w:dontgrowautofit/> <w:splitpgbreakandparamark/> <w:dontvertaligncellwithsp/> <w:dontbreakconstrainedforcedtables/> <w:dontvertalignintxbx/> <w:word11kerningpairs/> <w:cachedcolbalance/> </w:Compatibility> <w:browserlevel>MicrosoftInternetExplorer4</w:BrowserLevel> <m:mathpr> <m:mathfont val="Cambria Math"> <m:brkbin val="before"> <m:brkbinsub val="--"> <m:smallfrac val="off"> <m:dispdef/> <m:lmargin val="0"> <m:rmargin val="0"> <m:defjc val="centerGroup"> <m:wrapindent val="1440"> <m:intlim val="subSup"> <m:narylim val="undOvr"> </m:mathPr></w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:latentstyles deflockedstate="false" defunhidewhenused="true" defsemihidden="true" defqformat="false" defpriority="99" latentstylecount="267"> <w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Normal"> <w:lsdexception locked="false" priority="9" semihidden="false" unhidewhenused="false" qformat="true" name="heading 1"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 2"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 3"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 4"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 5"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 6"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 7"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 8"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 9"> <w:lsdexception locked="false" priority="39" name="toc 1"> <w:lsdexception locked="false" priority="39" name="toc 2"> <w:lsdexception locked="false" priority="39" name="toc 3"> <w:lsdexception locked="false" priority="39" name="toc 4"> <w:lsdexception locked="false" priority="39" name="toc 5"> <w:lsdexception locked="false" priority="39" name="toc 6"> <w:lsdexception locked="false" priority="39" name="toc 7"> <w:lsdexception locked="false" priority="39" name="toc 8"> <w:lsdexception locked="false" priority="39" name="toc 9"> <w:lsdexception locked="false" priority="35" qformat="true" name="caption"> <w:lsdexception locked="false" priority="10" semihidden="false" unhidewhenused="false" qformat="true" name="Title"> <w:lsdexception locked="false" priority="1" name="Default Paragraph Font"> <w:lsdexception locked="false" priority="11" semihidden="false" unhidewhenused="false" qformat="true" name="Subtitle"> <w:lsdexception locked="false" priority="22" semihidden="false" unhidewhenused="false" qformat="true" name="Strong"> <w:lsdexception locked="false" priority="20" semihidden="false" unhidewhenused="false" qformat="true" name="Emphasis"> <w:lsdexception locked="false" priority="59" semihidden="false" unhidewhenused="false" name="Table Grid"> <w:lsdexception locked="false" unhidewhenused="false" name="Placeholder Text"> <w:lsdexception locked="false" priority="1" semihidden="false" unhidewhenused="false" qformat="true" name="No Spacing"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 1"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 1"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 1"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 1"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 1"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 1"> <w:lsdexception locked="false" unhidewhenused="false" name="Revision"> <w:lsdexception locked="false" priority="34" semihidden="false" unhidewhenused="false" qformat="true" name="List Paragraph"> <w:lsdexception locked="false" priority="29" semihidden="false" unhidewhenused="false" qformat="true" name="Quote"> <w:lsdexception locked="false" priority="30" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Quote"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 1"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 1"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 1"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 1"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 1"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 1"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 1"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 1"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 2"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 2"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 2"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 2"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 2"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 2"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 2"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 2"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 2"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 2"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 2"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 2"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 2"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 2"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 3"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 3"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 3"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 3"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 3"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 3"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 3"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 3"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 3"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 3"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 3"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 3"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 3"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 3"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 4"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 4"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 4"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 4"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 4"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 4"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 4"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 4"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 4"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 4"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 4"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 4"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 4"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 4"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 5"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 5"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 5"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 5"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 5"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 5"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 5"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 5"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 5"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 5"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 5"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 5"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 5"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 5"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 6"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 6"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 6"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 6"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 6"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 6"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 6"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 6"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 6"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 6"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 6"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 6"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 6"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 6"> <w:lsdexception locked="false" priority="19" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Emphasis"> <w:lsdexception locked="false" priority="21" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Emphasis"> <w:lsdexception locked="false" priority="31" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Reference"> <w:lsdexception locked="false" priority="32" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Reference"> <w:lsdexception locked="false" priority="33" semihidden="false" unhidewhenused="false" qformat="true" name="Book Title"> <w:lsdexception locked="false" priority="37" name="Bibliography"> <w:lsdexception locked="false" priority="39" qformat="true" name="TOC Heading"> </w:LatentStyles> </xml><![endif]--><style> <!-- /* Font Definitions */ @font-face {font-family:"Cambria Math"; panose-1:0 0 0 0 0 0 0 0 0 0; mso-font-charset:1; mso-generic-font-family:roman; mso-font-format:other; mso-font-pitch:variable; mso-font-signature:0 0 0 0 0 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin-top:0in; margin-right:0in; margin-bottom:10.0pt; margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:Arial; mso-bidi-theme-font:minor-bidi;} p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph {mso-style-priority:34; mso-style-unhide:no; mso-style-qformat:yes; margin-top:0in; margin-right:0in; margin-bottom:10.0pt; margin-left:.5in; mso-add-space:auto; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:Arial; mso-bidi-theme-font:minor-bidi;} p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst {mso-style-priority:34; mso-style-unhide:no; mso-style-qformat:yes; mso-style-type:export-only; margin-top:0in; margin-right:0in; margin-bottom:0in; margin-left:.5in; margin-bottom:.0001pt; mso-add-space:auto; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:Arial; mso-bidi-theme-font:minor-bidi;} p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle {mso-style-priority:34; mso-style-unhide:no; mso-style-qformat:yes; mso-style-type:export-only; margin-top:0in; margin-right:0in; margin-bottom:0in; margin-left:.5in; margin-bottom:.0001pt; mso-add-space:auto; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:Arial; mso-bidi-theme-font:minor-bidi;} p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast {mso-style-priority:34; mso-style-unhide:no; mso-style-qformat:yes; mso-style-type:export-only; margin-top:0in; margin-right:0in; margin-bottom:10.0pt; margin-left:.5in; mso-add-space:auto; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:Arial; mso-bidi-theme-font:minor-bidi;} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:Arial; mso-bidi-theme-font:minor-bidi;} .MsoPapDefault {mso-style-type:export-only; margin-bottom:10.0pt; line-height:115%;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} /* List Definitions */ @list l0 {mso-list-id:278028952; mso-list-type:hybrid; mso-list-template-ids:-1440293170 929569794 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;} @list l0:level1 {mso-level-text:%1-; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in;} ol {margin-bottom:0in;} ul {margin-bottom:0in;} --> </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;} </style> <![endif]-->
<br /><p style="color: rgb(0, 0, 0);font-family:arial;" class="MsoNormal"><span style="font-size:100%;">Managers sometimes follow weird strategies to make employees attend business meeting. I have heard about some of these weird strategies and I was totally shocked. Business meetings will be effective, valuable and useful only if there is a common language between both manager and employees.
<br />
<br />There are a lot of questions need to be answered by you as a manager
<br />
<br />Why do employees hate business meeting?
<br />
<br />What can be done to make them attend business meetings not just because they have to but also because they love to?
<br />
<br />How can I as a manager benefit from Business meeting?
<br />
<br />Should employees also benefit from Business meeting?
<br />
<br />According to my point of view employees hate business meeting because it is boring, the feeling that they are there just to listen .no argues, no contributions also make them hate to attend. If you let employees feel that there is only one decision maker in the organization this may lead to more dangerous things than just hate to attend Business meetings.
<br />
<br />In Business meetings everyone is there to benefit from others, Managers are there to benefit from employees and employees are there to benefit from each other and from Managers.
<br />
<br />Listen to your employee’s point of views about your decisions and ask for suggestions.
<br />
<br />Here are small tips that can be done:
<br />
<br />1- Make a title for each meeting, this title should be a challenging one, and ask your employees to help you choosing the title of the next meeting.
<br />
<br />
<br />2- There should be an Agenda highlighting the main issues you are going to discuss, this Agenda should be with employees at least a day before the meeting.
<br />
<br />
<br />3- Reserve the first 15 minutes of each meeting , asking if the last meeting was effective, if the things that you all agreed to be done are already handled or what?.
<br />
<br />
<br />4- Make a monthly award for the best contributors in meetings.
<br />
<br />
<br />5- Choose one of the most effective employees and let his/her name be the title of one of the meetings.
<br />
<br />
<br />6- Never feel shame to ask your employees if you have met their expectations.
<br />
<br />
<br />7- Try to introduce the problems (if any) to your employees not to introduce your employees to problems.
<br />
<br />
<br />8- Get your employees involved in the meeting, talk, argue and finally come to a conclusion.
<br />
<br />
<br />9- Let your employees feel that they are decision makers.
<br />
<br />
<br />10- Employees are not there just to listen to you; you should listen to them more.
<br />
<br />
<br />11- Ask employees how they see the Organization after 5 years and from their answers you can see how good and bad is the organization.
<br />
<br />
<br />12- Forget about this sulky manager; try to impress your employees with your smile.
<br />
<br />
<br />
<br />13- Let your employees see that you are seeking solutions rather than seeking punishment as a solution , punishment is not a modern solution and it affect employees badly.
<br />
<br /><span style="color: rgb(0, 0, 0);">and finally act as if the organization is there not to take from employees but to give them and they will give the organization more that what you expect.</span>
<br />
<br />
<br /></span></p> <p class="MsoListParagraphCxSpMiddle" style="text-indent: -0.25in; color: rgb(0, 0, 0); font-family: arial;"></p><p style="color: rgb(0, 0, 0);font-family:arial;" class="MsoListParagraphCxSpLast"><span style="font-size:100%;"><o:p> </o:p></span></p><span style="color: rgb(0, 0, 0);font-size:100%;" ><span style="font-family:arial;"> </span></span> <p style="color: rgb(0, 0, 0);font-family:arial;" class="MsoNormal"><span style="font-size:100%;"><span style=""> </span></span></p> <p style="color: rgb(0, 0, 0);font-family:arial;" class="MsoNormal"><span style="font-size:100%;"><span style=""> </span></span></p> <p style="color: rgb(0, 0, 0);font-family:arial;" class="MsoNormal"><span style="font-size:100%;"><o:p> </o:p></span></p> <p style="color: rgb(0, 0, 0);font-family:arial;" class="MsoNormal"><span style="font-size:100%;"><o:p> </o:p></span></p> <p style="color: rgb(0, 0, 0);font-family:arial;" class="MsoNormal"><span style="font-size:100%;"><o:p> </o:p></span></p> <p style="color: rgb(0, 0, 0);font-family:arial;" class="MsoNormal"><span style="font-size:100%;"><o:p> </o:p></span></p> monahttp://www.blogger.com/profile/06677854988036291962noreply@blogger.com1tag:blogger.com,1999:blog-4793069445331811147.post-27630505091541581992008-10-19T04:05:00.000-07:002008-10-19T04:10:51.580-07:00What Makes a Good Business Analyst By Tony de Bree<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPsYFDt3SP6y3MpgxMcD_8PRWmfb3LN3-vx1mC82iPRQQtdWck6Bpkt3Q-5CY-A0WinJ341PJrLzxAZcNniMAf5lIXBBIq03r5uRXzQwDGBTkgrZvWD3cLKAEr82PfUPDEwG_tqCX4yAO1/s1600-h/business-analysis.jpg"><img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPsYFDt3SP6y3MpgxMcD_8PRWmfb3LN3-vx1mC82iPRQQtdWck6Bpkt3Q-5CY-A0WinJ341PJrLzxAZcNniMAf5lIXBBIq03r5uRXzQwDGBTkgrZvWD3cLKAEr82PfUPDEwG_tqCX4yAO1/s400/business-analysis.jpg" alt="" id="BLOGGER_PHOTO_ID_5258820383171254530" border="0" /></a><br /><span style="color: rgb(0, 0, 0);font-size:130%;" ><span style="font-family:arial;">There are several key points one needs to understand before deciding whether or not to become a business analyst. You may be qualified to do the job you were hired to do. Yet is it the job you wanted to do? Some analysts find themselves locked in a cubical writing reports all day, only to find the report was not used or even read. They realize they are in a dead end job going no-where fast. This is not the usual dream one has when becoming a business analyst.</span><br /><br /><span style="font-family:arial;"> A good business analyst is creative, a people person. Someone wanting a more hands on approach to business and problem solving. The good business analyst will look for opportunities to grow and learn. He or she will listen attentively to what others are saying. The good business analyst is like a walking encyclopedia about the company he or she works within. They will know people from every department.</span><br /><br /><span style="font-family:arial;"> The good business analyst may be a part of the IT team or department. He or she may even be able to produce usable code for practical remedies to small tasks. He or she will understand technology and the jargon that leaves the common layperson confused.</span><br /><br /><span style="font-family:arial;"> What makes a good business analyst is the ability to listen to what is being said and hear what is not. The good business analyst can read into the meaning of stakeholders words. He or she can understand the needs being expressed when the stakeholders do not always know what they are. The good business analyst will be able to determine if the requests from stakeholders or end users are viable. In some cases they are not and it is up to the business analyst to inform what can be done versus what is wanted.</span><br /><br /><span style="font-family:arial;"> The good business analyst will have information available about the latest technology. He or she will know the formulas or programs used by corporate peers. The good business analyst will be able to recognize trends and differentiate between them and fads. They will understand the end user market.</span><br /><br /><span style="font-family:arial;"> The good business analyst will understand people. He or she will be a motivational person who can gear people into wanting to complete a project. The good business analyst will be able to point out someone's strengths and help to build on those. He or she will recognize when a person is having a conflict and try to help resolve the issue. He or she may even be able to create teamwork within separate departments to meet a goal or deadline.</span><br /><br /><span style="font-family:arial;"> The good business analyst commands respect because he or she gives respect. You will not find the good business analyst spreading rumors or gossiping. He or she will squelch the first signs of trouble and stand up for what he or she believes in. There is no room for garbage in the office.</span><br /><br /><span style="font-family:arial;"> The good business analyst is a visionary, a creative thinker, and innovative. He or she is fun to work with and carries a positive attitude. Very few people do not like the good business analyst.<br /><br /><a href="http://www.modernanalyst.com/Resources/Articles/tabid/115/articleType/ArticleView/articleId/195/What-Makes-a-Good-Business-Analyst.aspx">the Original Link</a><br /></span></span>monahttp://www.blogger.com/profile/06677854988036291962noreply@blogger.com0tag:blogger.com,1999:blog-4793069445331811147.post-55305500405629593242008-09-11T04:36:00.000-07:002010-12-01T18:28:25.926-08:00Repeater with Empty Data Template<script type="text/javascript"><br />window.google_analytics_uacct = "UA-5774424-1";<br /></script><br /><br /><span style="color: rgb(0, 0, 0);font-size:130%;" ><span style="font-family:arial;">most of us are using Repeaters to display Data also we faced the situation of retrieving no result to display so the Repeater will be Empty or we will need to handle this case from code behind to check the number of items and if zero we show a label with No Result found or no records to display message.</span><br /><br /><span style="font-family:arial;">we can do this with a simpler way and with no need to write anything in code behind ,let's see how</span><br /></span><blockquote style="color: rgb(0, 0, 0);font-family:arial;" ><span style="font-size:130%;"><br /></span> <span class="c1" style="font-size:130%;"><asp:Repeater ID=</span><span class="c2" style="font-size:130%;">"RptrContacts"</span><span class="c3" style="font-size:130%;"> runat=</span><span class="c2" style="font-size:130%;">"server"</span><span class="c3" style="font-size:130%;">></span><span style="font-size:130%;"><br /><br /></span> <span class="c1" style="font-size:130%;"><ItemTemplate></span><span style="font-size:130%;"><br /><br /></span> <span class="c4" style="font-size:130%;"> </span><span style="font-size:130%;"><i class="c5"><!-- Add your Item Template Here --></i><br /><br /></span> <span class="c4" style="font-size:130%;"> </span><span class="c3" style="font-size:130%;"></ItemTemplate></span><span style="font-size:130%;"><br /><br /></span> <span class="c4" style="font-size:130%;"> </span><span class="c3" style="font-size:130%;"><FooterTemplate></span><span style="font-size:130%;"><br /><br /></span> <span class="c4" style="font-size:130%;"> </span><span class="c3" style="font-size:130%;"><asp:Label ID=</span><span class="c2" style="font-size:130%;">"lblEmpty"</span><span style="font-size:130%;"><br /><br /></span> <span class="c1" style="font-size:130%;"> Text=</span><span class="c2" style="font-size:130%;">"no result"</span><span class="c3" style="font-size:130%;"> runat=</span><span class="c2" style="font-size:130%;">"server"</span><span style="font-size:130%;"><br /><br /></span> <span class="c1" style="font-size:130%;"> Visible=</span><span class="c2" style="font-size:130%;">'<%#bool.Parse((RptrContacts.Items.Count==0).ToString())%>'</span><span class="c3" style="font-size:130%;">></span><span style="font-size:130%;"><br /><br /></span> <span class="c4" style="font-size:130%;"> </span><span class="c3" style="font-size:130%;"></asp:Label></span><span style="font-size:130%;"><br /><br /></span> <span class="c4" style="font-size:130%;"> </span><span class="c3" style="font-size:130%;"></FooterTemplate></span><span style="font-size:130%;"><br /><br /></span> <span class="c4" style="font-size:130%;"> </span><span class="c3" style="font-size:130%;"></asp:Repeater><br /><br /> </span><span style="font-size:130%;"><br /></span></blockquote><span style="color: rgb(0, 0, 0);font-size:130%;" ><br /><span style="font-family:arial;">here we will display a label with "no result" message in the footer we just need to add a label and set it's text property with the message we want.</span><br /><br /><span style="font-family:arial;">then we set the Visible property of the label with the value coming out from the following expression </span><br /><br /></span><blockquote style="color: rgb(0, 0, 0);font-family:arial;" ><span style="font-size:130%;"><br /><%#bool.Parse((RptrContacts.Items.Count==0).ToString())%><br /></span></blockquote><span style="color: rgb(0, 0, 0);font-size:130%;" ><br /><br /><span style="font-family:arial;">it checks if the number of Items equals zero or not , if it equals zero it returns True so the label will be visible and if not it will return False so the label will be invisible.</span></span>monahttp://www.blogger.com/profile/06677854988036291962noreply@blogger.com16tag:blogger.com,1999:blog-4793069445331811147.post-33252872370674250362008-08-16T07:34:00.000-07:002008-10-13T07:13:56.284-07:00Custom Controls in Details(Part 1)<span style="color: rgb(0, 0, 0);font-size:130%;" ><span style="font-family: arial;">Most of us are using User Controls that enable us to create a Control that can be used many times in the same project and sure this helps us not to duplicate the code but what if you want this user Control to be used in different projects in this Case you can not use User Controls as you will have to Create this User Control in every new project you may need to use this User Control in, in this Case you may need to Use Custom Controls instead of User Controls.</span><br /><br /><span style="font-family: arial;">Limitations of User Controls: </span><br /><br /><span style="font-family: arial;">-Can not be shared among Different Projects.</span><br /><span style="font-family: arial;">-Can not inherit from other Server Side Controls.</span><br /><br /><span style="font-family: arial;">Custom Controls Adv:</span><br /><br /><span style="font-family: arial;">-Can be shared among Different Projects.</span><br /><span style="font-family: arial;">-Can inherit from other Server Side Controls.</span><br /><span style="font-family: arial;">-A Custom Control can inherit from another Custom Control.</span><br /><br /><span style="font-family: arial;">Custom Controls DisAdv:</span><br /><br /><span style="font-family: arial;">-you can not say that its complex but it may require much work than User Controls.</span><br /><br /><span style="font-family: arial;">Let's see if Custom Controls are Complex or not </span><br /><br /><span style="font-family: arial;">Example (1)</span><br /><span style="font-family: arial;">In this example we will try to create a TextBox with a label, most of the times we are using TextBoxs we need to put a label before this TextBox to define the type of Data to be written in it, don’t you think that it will be good if you have both of them in a one Server Control, let's start</span><br /><br /><span style="font-family: arial;">Step (1)</span><br /></span><blockquote style="font-family: arial; color: rgb(0, 0, 0);"><span style="font-size:130%;"><br />Open your Visual Studio<br /><br />VS 2005 File-->New -->Project-->Visual C#-->Windows -->WebControlLibrary<br /><br /><br />VS 2008 File-->New -->Project-->Visual C#-->Web -->ASP.Net Server Control<br /></span></blockquote><span style="color: rgb(0, 0, 0);font-size:130%;" ><br /><br /><span style="font-family: arial;">Step (2)</span><br /><span style="font-family: arial;">Now you need to create a website to be able to test your site so add a new website to this Project </span><br /><br /><span style="font-family: arial;">Step (3)</span><br /><br /><span style="font-family: arial;">Let's go back to our server Control and start to code</span><br /><br /><span style="font-family: arial;">First of all we want to add a label and Textbox we can do that by overriding the CreateChildControls method, Controls are added to your Custom Control in this Method so let's add the Label and the TextBox</span><br /><br /><span style="font-family: arial;">First let your Class inherits from System.Web.UI.WebControls.WebControl</span><br /><br /><span style="font-family: arial;">Then override CreateChildControls method</span><br /></span><blockquote style="font-family: arial; color: rgb(0, 0, 0);"><span style="font-size:130%;"><br />protected override void CreateChildControls()<br /> {<br /> this.ChildControlsCreated = true;<br /> this.Controls.Clear();<br /><br /> Label lblID = new Label();<br /> lblID.Text =LabelText ;<br /> lblID.ID = LabelID;<br /><br /> TextBox txt = new TextBox();<br /> txt.ID = TextBoxID;<br /><br /><br /> this.Controls.Add(lblID);<br /> this.Controls.Add(txt);<br /> }<br /></span> </blockquote><span style="color: rgb(0, 0, 0);font-size:130%;" ><br /><span style="font-family: arial;">First we set the Property ChildControlsCreated to true to be as an indicator that our Controls are created we will speak about this later then we Clear all the previously added Controls, declare our Label and TextBox then add them to the Custom Control Controls.</span><br /><br /><span style="font-family: arial;">Step (4)</span><br /><span style="font-family: arial;"> Now build this project, and then go back to your test website and open the test page design and you will find your control added to the Toolbox, Drag and Drop it to your page you will see nothing as the CreateChildControls method adds your controls at runtime but still you can view your controls just follow the following step.</span><br /><br /><a style="font-family: arial;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIwByawX0aCdXcoFzFxS-w1H0CDwkxNK1LL_TY8DyoGFa_z25f5rWA48LJ9R22fNS9noS9yN9dp7H539u3q1t03o3VN40Opr-g_n-6OTA7PXtWgFgGs0K2gYBAfaMjB6ZTSDaWEcPkK4uG/s1600-h/Toolbox.JPG"><img style="cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIwByawX0aCdXcoFzFxS-w1H0CDwkxNK1LL_TY8DyoGFa_z25f5rWA48LJ9R22fNS9noS9yN9dp7H539u3q1t03o3VN40Opr-g_n-6OTA7PXtWgFgGs0K2gYBAfaMjB6ZTSDaWEcPkK4uG/s400/Toolbox.JPG" alt="" id="BLOGGER_PHOTO_ID_5235154136022788050" border="0" /></a><br /><br /><span style="font-family: arial;">Step (5)</span><br /><span style="font-family: arial;"> Let's override onInit method to be able to see your Controls at design time</span><br /></span><blockquote style="font-family: arial; color: rgb(0, 0, 0);"><span style="font-size:130%;"><br />protected override void OnInit(EventArgs e)<br /> {<br /> base.OnInit(e);<br /> if (this.DesignMode == true)<br /> {<br /> this.EnsureChildControls();<br /> }<br /> }<br /></span></blockquote><span style="color: rgb(0, 0, 0);font-size:130%;" ><br /><span style="font-family: arial;">First we check that if you are displaying this Custom Control in design mode then call the EnsureChildControls Method which first Check the value of the Property ChildControlsCreated that we mentioned before this Property is just to make sure that our Controls will not be created more than once. If the value is true then it will not create the Controls if false it will create our Controls.</span><br /><br /><span style="font-family: arial;">Now build your Server Control project again, and go back to your page and refresh it and you will see your controls.</span><br /><br /><a style="font-family: arial;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh72iayxh0MqdqwCb5iTt_I75-sLtjeSs6KFiRC-oriOZ_ptNRzLH5lMD6jgrWHabtxPbBm46aCT-wkVfNyKqKPwRuzzsKrJxj6V8vPr90ybuFp9s5QrZBoxCZMoXY-t-MU_RS2HF2YAVYX/s1600-h/ControlsAppear.JPG"><img style="cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh72iayxh0MqdqwCb5iTt_I75-sLtjeSs6KFiRC-oriOZ_ptNRzLH5lMD6jgrWHabtxPbBm46aCT-wkVfNyKqKPwRuzzsKrJxj6V8vPr90ybuFp9s5QrZBoxCZMoXY-t-MU_RS2HF2YAVYX/s400/ControlsAppear.JPG" alt="" id="BLOGGER_PHOTO_ID_5235153804881854258" border="0" /></a><br /><br /><span style="font-family: arial;">Step (6)</span><br /><span style="font-family: arial;"> Now we need to make sure that the name of our server Control will be unique we can make ASP.Net to prefix our controls (Label and Textbox) with the name of the Custom Control, just let your Server Control implement INamingContainer Interface</span><br /><br /><a style="font-family: arial;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFlT0CNalFGfIGVwkXT4VFhK0hg5s8X0AtnfsJLaV98CqNBvaOJUDz1ggD8fBZrH1b3jTXPDSvGH_o0tSzjuAbEG8_TI4SGZBsmzlPFNTrhQ1SrB3ogfqk7jNf0vgQ0OP9XflmyMZ-RjEl/s1600-h/inamingContainer.JPG"><img style="cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFlT0CNalFGfIGVwkXT4VFhK0hg5s8X0AtnfsJLaV98CqNBvaOJUDz1ggD8fBZrH1b3jTXPDSvGH_o0tSzjuAbEG8_TI4SGZBsmzlPFNTrhQ1SrB3ogfqk7jNf0vgQ0OP9XflmyMZ-RjEl/s400/inamingContainer.JPG" alt="" id="BLOGGER_PHOTO_ID_5235175235068328066" border="0" /></a><br /><br /><span style="font-family: arial;">Step (7)</span><br /><span style="font-family: arial;"> Now you want to be able to access the Label and the TextBox from the Controls collection in your Custom Control using FindControl Method, you can do this by assigning a value to the ID property of both the Label and TextBox.</span><br /><br /><span style="font-family: arial;">Let's see how we can do so, now switch to your Code Behind</span><br /><br /><span style="font-family: arial;">And add two properties one for Label ID and TextBox ID</span><br /></span><blockquote style="font-family: arial; color: rgb(0, 0, 0);"><span style="font-size:130%;"><br /> [Bindable(true)]<br /> [Category("Misc")]<br /> [DefaultValue("")]<br /> [Localizable(true)]<br /> public string TextBoxID<br /> {<br /> get<br /> {<br /> String s = (String)ViewState["TextBoxID"];<br /> return ((s == null) ? "[" + this.ID + "]" : s);<br /> }<br /><br /> set<br /> {<br /> ViewState["TextBoxID"] = value;<br /> }<br /> }<br /></span></blockquote><span style="color: rgb(0, 0, 0);font-size:130%;" ><br /><span style="font-family: arial;">And one for Label ID</span><br /></span><blockquote style="font-family: arial; color: rgb(0, 0, 0);"><span style="font-size:130%;"><br /> [Bindable(true)]<br /> [Category("Misc")]<br /> [DefaultValue("")]<br /> [Localizable(true)]<br /> public string LabelID<br /> {<br /> get<br /> {<br /> String s = (String)ViewState["LabelID"];<br /> return ((s == null) ? "[" + this.ID + "]" : s);<br /> }<br /><br /> set<br /> {<br /> ViewState["LabelID"] = value;<br /> }<br /> }<br /></span></blockquote><span style="color: rgb(0, 0, 0);font-size:130%;" ><br /><span style="font-family: arial;"> Now build your server control project and back to your test page and refresh it, select your server control and press F4 and see the properties </span><br /><br /><a style="font-family: arial;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhS64xoFmMZt3TnpViZDW9iOvMwdlIoUiJp8jGm0_PK-jXdh2o_0IWRGOwqUDddL6-jy2T82qfkagO0eiVmtOjzxt2o8sOOOlfgDVvTMlLQuDlMn9lqjBzlYspXX8NfXYJJ9bH7-BzKjfjb/s1600-h/IDs.JPG"><img style="cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhS64xoFmMZt3TnpViZDW9iOvMwdlIoUiJp8jGm0_PK-jXdh2o_0IWRGOwqUDddL6-jy2T82qfkagO0eiVmtOjzxt2o8sOOOlfgDVvTMlLQuDlMn9lqjBzlYspXX8NfXYJJ9bH7-BzKjfjb/s400/IDs.JPG" alt="" id="BLOGGER_PHOTO_ID_5235156611700375042" border="0" /></a><br /><br /><span style="font-family: arial;">Step (8)</span><br /><span style="font-family: arial;">Now you want to set the Text Property of your Label just add the following property </span><br /><br /></span><blockquote style="font-family: arial; color: rgb(0, 0, 0);"><span style="font-size:130%;"><br />[Bindable(true)]<br /> [Category("Appearance")]<br /> [DefaultValue("Label")]<br /> [Localizable(true)]<br /> public string LabelText<br /> {<br /> get<br /> {<br /> String s = (String)ViewState["LabelText"];<br /> return ((s == null) ? "[" + this.ID + "]" : s);<br /> }<br /><br /> set<br /> {<br /> ViewState["LabelText"] = value;<br /> }<br /> }<br /></span></blockquote><span style="color: rgb(0, 0, 0);font-size:130%;" ><br /><br /><span style="font-family: arial;">now run your Server Control Project and go back to your test Page ,refresh it</span><br /><span style="font-family: arial;">then view the properties of your Custom Control and you will find your property there</span><br /><a style="font-family: arial;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgtlNATmEjxzlvwgJCJtwBo53klTZnD4ebsIeyhO9uGj4c60raZwaDkljiRDOGe3bXpZZ1CgWFASTQIH1cAwv1hiGl4EIadYDo-2Gh60YEwsDXYJoQcsY9Foh9YhJWtOzVuHnBxQnkpYXZ/s1600-h/labeltext.JPG"><img style="cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgtlNATmEjxzlvwgJCJtwBo53klTZnD4ebsIeyhO9uGj4c60raZwaDkljiRDOGe3bXpZZ1CgWFASTQIH1cAwv1hiGl4EIadYDo-2Gh60YEwsDXYJoQcsY9Foh9YhJWtOzVuHnBxQnkpYXZ/s400/labeltext.JPG" alt="" id="BLOGGER_PHOTO_ID_5235172364430081378" border="0" /></a><br /><br /><span style="font-family: arial;">Step (9)</span><br /><span style="font-family: arial;">Now you want to know more about Style and how to apply style to your Custom Control,let's try to add a style to our Custom Control </span><br /></span><blockquote style="font-family: arial; color: rgb(0, 0, 0);"><span style="font-size:130%;"><br />body {<br />}<br />.textbox<br />{<br />background-color:Red;<br />}<br /></span></blockquote><span style="color: rgb(0, 0, 0);font-size:130%;" ><br /><br /><span style="font-family: arial;">now in the CssClass Property of your Server Control write textbox, and run your page</span><br /><a style="font-family: arial;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_bJzkkPpMy-qIjh8jQHF0MHq8d3f2AqrRuw5RCux3LUQbxgkC3qY6m39NtJlK5cmm61Ehf8PyMCNIficluGasQ3lpVK7D0gaYaLKFHIwfhJkwH3jvGzsiIWp0pZ39x8Fg6JOCUJGXufFr/s1600-h/ss.JPG"><img style="cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_bJzkkPpMy-qIjh8jQHF0MHq8d3f2AqrRuw5RCux3LUQbxgkC3qY6m39NtJlK5cmm61Ehf8PyMCNIficluGasQ3lpVK7D0gaYaLKFHIwfhJkwH3jvGzsiIWp0pZ39x8Fg6JOCUJGXufFr/s400/ss.JPG" alt="" id="BLOGGER_PHOTO_ID_5235185734127690146" border="0" /></a><br /><br /><span style="font-family: arial;">may be you need to apply a style to label only on TextBox only or even Different Style for both, let's see how we can do this</span><br /><br /><span style="font-family: arial;">let's first create our style classes</span><br /></span><blockquote style="font-family: arial; color: rgb(0, 0, 0);"><span style="font-size:130%;"><br />.textboxbackground<br />{<br />background-color:Red;<br />}<br /><br />.labelbackground<br />{<br />background-color:Blue;<br />}<br /></span></blockquote><span style="color: rgb(0, 0, 0);font-size:130%;" ><br /><br /><span style="font-family: arial;">then back to your server control Code Behind and add the following Properties</span><br /><br /></span><blockquote style="font-family: arial; color: rgb(0, 0, 0);"><span style="font-size:130%;"><br />[Bindable(true)]<br /> [Category("Appearance")]<br /> [DefaultValue("")]<br /> [Localizable(true)]<br /> public string LabelCssClass<br /> {<br /> get<br /> {<br /> String s = (String)ViewState["LabelCssClass"];<br /> return ((s == null) ? "[" + this.ID + "]" : s);<br /> }<br /><br /> set<br /> {<br /> ViewState["LabelCssClass"] = value;<br /> }<br /> }<br /><br /><br />[Bindable(true)]<br /> [Category("Appearance")]<br /> [DefaultValue("")]<br /> [Localizable(true)]<br /> public string TextBoxCssClass<br /> {<br /> get<br /> {<br /> String s = (String)ViewState["TextBoxCssClass"];<br /> return ((s == null) ? "[" + this.ID + "]" : s);<br /> }<br /><br /> set<br /> {<br /> ViewState["TextBoxCssClass"] = value;<br /> }<br /> }<br /><br /></span></blockquote><span style="color: rgb(0, 0, 0);font-size:130%;" ><br /><br /><span style="font-family: arial;">and in CreateChildControls Method add the following lines</span><br /></span><blockquote style="font-family: arial; color: rgb(0, 0, 0);"><span style="font-size:130%;"><br /> lblID.CssClass = LabelCssClass;<br /> txt.CssClass = TextBoxCssClass;<br /></span></blockquote><span style="color: rgb(0, 0, 0);font-size:130%;" ><br /><br /><span style="font-family: arial;">now build your Server Control Project and switch back to your test page and as usual refresh it and view the Properties of your Control and fill it with Style Classes names</span><br /><a style="font-family: arial;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1Yxm3zzrsgv_7cS9DpCbKLK9NbGCYQqq6-JBPVLA24GCRkGP68VSos_gpolDnfaz0jnMRfPgTzXjrusSQfbCsEmYbQ1c1QMtNZDULQr0SQweExDGdOm0SIrWXfZc0zMuymbRI3Ba0fZgH/s1600-h/styles.JPG"><img style="cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1Yxm3zzrsgv_7cS9DpCbKLK9NbGCYQqq6-JBPVLA24GCRkGP68VSos_gpolDnfaz0jnMRfPgTzXjrusSQfbCsEmYbQ1c1QMtNZDULQr0SQweExDGdOm0SIrWXfZc0zMuymbRI3Ba0fZgH/s400/styles.JPG" alt="" id="BLOGGER_PHOTO_ID_5235190767693811122" border="0" /></a><br /><br /><span style="font-family: arial;">now run your test page </span><br /><a style="font-family: arial;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhna8B3RJlgIdVqgRBgaTp_bEoGQDolNq8oQofpsNav2m2xNv6vKmQ_Uzef5TMRGH9zkPaQLPyn2_OcxQRApBNsBfKEatQVW-b4hwgLkQh_B6d2xLyc80mejH8K95piswfiWY2FoYXyHRgw/s1600-h/afterstyles.JPG"><img style="cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhna8B3RJlgIdVqgRBgaTp_bEoGQDolNq8oQofpsNav2m2xNv6vKmQ_Uzef5TMRGH9zkPaQLPyn2_OcxQRApBNsBfKEatQVW-b4hwgLkQh_B6d2xLyc80mejH8K95piswfiWY2FoYXyHRgw/s400/afterstyles.JPG" alt="" id="BLOGGER_PHOTO_ID_5235191650353246210" border="0" /></a></span>monahttp://www.blogger.com/profile/06677854988036291962noreply@blogger.com0tag:blogger.com,1999:blog-4793069445331811147.post-55375276058227681592008-08-14T14:44:00.000-07:002008-10-13T07:15:03.326-07:00Use extension Methods to Add new Functionality to ASP.Net Server Controls<span style="color: rgb(0, 0, 0);font-size:130%;" ><span style="font-family: arial;">i'm sure that most of you know enough about extension methods and for those who don't ,</span><br /><span style="font-family: arial;">extension methods are used to new methods to an existing type without any effort to modify the original type.</span><br /><br /><span style="font-family: arial;">let's now start to see how we can use extension methods to add new functionality to ASP.Net Server Control.</span><br /><br /><span style="font-family: arial;">example (1)</span><br /><br /><span style="font-family: arial;">-with DropDownList</span><br /><br /><span style="font-family: arial;">here is the original way of adding new Items to DropDownList</span><br /></span><blockquote style="font-family: arial; color: rgb(0, 0, 0);"><span style="font-size:130%;"><br />DropDownList1.Items.Add(new ListItem("mona"));<br /><br />or<br /><br />ListItem li = new ListItem("mona");<br />DropDownList1.Items.Add(li);<br /></span></blockquote> <span style="color: rgb(0, 0, 0);font-size:130%;" ><br /><br /><span style="font-family: arial;">actually if you are going to Add only one item it's ok but what if you are going to add an array of items sure you are going to repeat the previous lines of code many times, let's now try to use an extension method to help us</span><br /><br /><span style="font-family: arial;">step(1)</span><br /><span style="font-family: arial;">Create a static Class called ControlsUtil</span><br /></span><blockquote style="font-family: arial; color: rgb(0, 0, 0);"><span style="font-size:130%;"><br />public static class ControlsUtil<br /> {<br /><br /> public static void AddToDDList(this DropDownList ddl, string values, bool IncludeEmpty)<br /> {<br /> string [] splitter;<br /> if (IncludeEmpty)<br /> splitter = values.Split(new char[] { ',' }, StringSplitOptions.None);<br /> else<br /> splitter = values.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);<br /> int Count = 0;<br /> while (Count <></blockquote><span style="color: rgb(0, 0, 0);font-size:130%;" ><br /><br /><span style="font-family: arial;">step(2)</span><br /><br /><span style="font-family: arial;">Create a web Page and add a DropDownList</span><br /><br /><span style="font-family: arial;">step(3)</span><br /><span style="font-family: arial;">Switch to Code Behind and write the following Code</span><br /></span><blockquote style="font-family: arial; color: rgb(0, 0, 0);"><span style="font-size:130%;"><br />public partial class _Default : System.Web.UI.Page<br /> {<br /> protected void Page_Load(object sender, EventArgs e)<br /> {<br /> DropDownList1.AddToDDList(" ,A,B,C,D,E,F,G,H", true);<br /> }<br /> }<br /></span></blockquote><span style="color: rgb(0, 0, 0);font-size:130%;" ><br /><br /><span style="font-family: arial;">step(4)</span><br /><span style="font-family: arial;">run you page and see the result</span><br /><br /><a style="font-family: arial;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijmvK9QO0IP_QgKbSW7mW4lfbBkH30TwFM4mCsZElYrUs8im8NbSnjJmWTYY-7Yh3NcM4jhC3Ai-KJ1sEfb3ohp6qV_g6nJGmXQkPfovDD6gSBjRPkIZKL2vMmCdYEbHMDNizN9vnXPcxT/s1600-h/ddl.JPG"><img style="cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijmvK9QO0IP_QgKbSW7mW4lfbBkH30TwFM4mCsZElYrUs8im8NbSnjJmWTYY-7Yh3NcM4jhC3Ai-KJ1sEfb3ohp6qV_g6nJGmXQkPfovDD6gSBjRPkIZKL2vMmCdYEbHMDNizN9vnXPcxT/s400/ddl.JPG" alt="" id="BLOGGER_PHOTO_ID_5234630060992379266" border="0" /></a><br /><br /></span> <hr style="font-family: arial; height: 4px; color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 0);font-size:130%;" ><br /><br /><span style="font-family: arial;">- with WebPage</span><br /><br /><span style="font-family: arial;">in many web pages there might be a lot of Textboxs that you may need to clear after clicking certain button sure you can Create your own method that clear all the Textboxs but you still need to repeat this method in every page, now let's use extension methods to help us.</span><br /><br /><span style="font-family: arial;">step (1)</span><br /><br /><span style="font-family: arial;">Open the Static class that we created before and add the following method</span><br /><br /></span><blockquote style="font-family: arial; color: rgb(0, 0, 0);"><span style="font-size:130%;"><br />public static void ClearTextBoxs(this object obj,IEnumerable e)<br /> {<br /> foreach (object o in e)<br /> {<br /> TextBox txt = o as TextBox;<br /> if (txt != null)<br /> txt.Text = string.Empty;<br /> }<br /> }<br /></span></blockquote><span style="color: rgb(0, 0, 0);font-size:130%;" ><br /><br /><span style="font-family: arial;">step (2)</span><br /><br /><span style="font-family: arial;">Create your web page that contains any number of Textboxs and a button</span><br /><br /><a style="font-family: arial;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEita6SHY0FlD1KjMp5HByKna8NqSHKIeS5FU-NC0W9-F38it0EdBw84bNeOTt7SGS2QAF2PT7P3T3futg30EDBgk1nYzCne2-eSTAE4K9KYfSsJhd2b9S-KtQVee18r6k2MQBmg8AlzsrgP/s1600-h/webpage.JPG"><img style="cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEita6SHY0FlD1KjMp5HByKna8NqSHKIeS5FU-NC0W9-F38it0EdBw84bNeOTt7SGS2QAF2PT7P3T3futg30EDBgk1nYzCne2-eSTAE4K9KYfSsJhd2b9S-KtQVee18r6k2MQBmg8AlzsrgP/s400/webpage.JPG" alt="" id="BLOGGER_PHOTO_ID_5234662670584457138" border="0" /></a><br /><br /><span style="font-family: arial;">step (3)</span><br /><br /><span style="font-family: arial;">now switch to code behind of the Button Click event and add the following code</span><br /></span><blockquote style="font-family: arial; color: rgb(0, 0, 0);"><span style="font-size:130%;"><br /> protected void Button1_Click(object sender, EventArgs e)<br /> {<br /> this.ClearTextBoxs(form1.Controls);<br /> }<br /></span></blockquote><span style="color: rgb(0, 0, 0);font-size:130%;" ><br /><br /><span style="font-family: arial;">step (4)</span><br /><br /><span style="font-family: arial;">run your page ,add text to the TextBoxs</span><br /><br /><a style="font-family: arial;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjnsxU0cMZI9FqZ07oZB5qN8Ycza7M0_9u_5pAkbhNaoMnbPxppUBzGMY50WKOgagNsaMURKHhcR260WtHtBPSCQNKc66ZfNXBErMKaVIUqL2oy_ZZ2DXHmv_165VzkmTgtHa8dsP9UUPI/s1600-h/before.JPG"><img style="cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjnsxU0cMZI9FqZ07oZB5qN8Ycza7M0_9u_5pAkbhNaoMnbPxppUBzGMY50WKOgagNsaMURKHhcR260WtHtBPSCQNKc66ZfNXBErMKaVIUqL2oy_ZZ2DXHmv_165VzkmTgtHa8dsP9UUPI/s400/before.JPG" alt="" id="BLOGGER_PHOTO_ID_5234663461700529298" border="0" /></a><br /><br /><span style="font-family: arial;">step (5)</span><br /><br /><span style="font-family: arial;">then Click the Button and see the result</span><br /><a style="font-family: arial;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdjg9zvlAr4dqsCBrHczq4LskeZuzI9vcgr1BmGZipp7MPY-WY0329DcEEhPIQVUbwn-MeLIKhMOTiTkkRCp4G6EAmb7T3ruGjuE_bOwsLJOQbIpA9ZUYFk_KY0UESVYXQj98VDAv-y2Cp/s1600-h/AFTER.JPG"><img style="cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdjg9zvlAr4dqsCBrHczq4LskeZuzI9vcgr1BmGZipp7MPY-WY0329DcEEhPIQVUbwn-MeLIKhMOTiTkkRCp4G6EAmb7T3ruGjuE_bOwsLJOQbIpA9ZUYFk_KY0UESVYXQj98VDAv-y2Cp/s400/AFTER.JPG" alt="" id="BLOGGER_PHOTO_ID_5234662218564949442" border="0" /></a><br /><br /><span style="font-family: arial;">Note: this method can also be used with UserContols not just webPages</span></span>monahttp://www.blogger.com/profile/06677854988036291962noreply@blogger.com2tag:blogger.com,1999:blog-4793069445331811147.post-13417457901333087252008-08-14T04:33:00.000-07:002008-10-13T07:15:24.340-07:00How to execute both Client side code and Server side code<span style="color: rgb(0, 0, 0);font-size:130%;" ><span style="font-family: arial;">sometimes you may need to call a Client Side code with Server Side Code, let's assume that you have a Button and you want to call a certain javascript function beside your function in the Code Behind,</span><br /><span style="font-family: arial;">here are some of the Examples when you may need so:</span><br /><br /><span style="font-family: arial;">1-Prevent User from Pressing certain Button more than once ,i.e Disable this Button until the server Side Function is processed</span><br /><br /><a style="font-family: arial;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKT7nsKC7qHBThEdrPOUpgPwzyu9ihpa9Z9E0gz-dPUpt7EErT4Uoq4sMXKS1w4eVhrIS84X5sZGZYRBV1W69zgy8sb0veMRfhKBA0tnzS3d-gfy5mpvXQEsh8fNhyphenhyphenOkRfWUDDTK36n9Sr/s1600-h/disabled.JPG"><img style="cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKT7nsKC7qHBThEdrPOUpgPwzyu9ihpa9Z9E0gz-dPUpt7EErT4Uoq4sMXKS1w4eVhrIS84X5sZGZYRBV1W69zgy8sb0veMRfhKBA0tnzS3d-gfy5mpvXQEsh8fNhyphenhyphenOkRfWUDDTK36n9Sr/s400/disabled.JPG" alt="" id="BLOGGER_PHOTO_ID_5234401793445197506" border="0" /></a><br /><br /><span style="font-family: arial;">here you have both onclick and onclientclick functions also i use usesubmitbehavior this property indicates whether your Button will use the Client Browser's Submit or will use the Postback which means that the page will be posted to the Server, here we set it to false which means that it will do Postback.</span><br /><br /><span style="font-family: arial;">2-Display a messagebox after Clicking the Button</span><br /><br /><a style="font-family: arial;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrp5bTa3QtHwkOu67rNLZPTTCic6jlhpGXZUsKjSnMfmN8qV87VIjbde46LD47HDsSiR20CYTZv4yNQomLUe51WjOriXX8byt9wPkzT_sg8_DTxF8DxsSZCf4kUr6ztX9HZjHhZcM8fO1e/s1600-h/alert.JPG"><img style="cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrp5bTa3QtHwkOu67rNLZPTTCic6jlhpGXZUsKjSnMfmN8qV87VIjbde46LD47HDsSiR20CYTZv4yNQomLUe51WjOriXX8byt9wPkzT_sg8_DTxF8DxsSZCf4kUr6ztX9HZjHhZcM8fO1e/s400/alert.JPG" alt="" id="BLOGGER_PHOTO_ID_5234402040884650722" border="0" /></a><br /><br /><br /><span style="font-family: arial;">hope you enjoy it.</span></span>monahttp://www.blogger.com/profile/06677854988036291962noreply@blogger.com0tag:blogger.com,1999:blog-4793069445331811147.post-70731680598782415522008-06-17T11:46:00.001-07:002008-10-13T07:15:43.093-07:00Catch event from Web User Control in Webpage<p class="MsoNormal" style="margin-bottom: 12pt; font-family: arial; color: rgb(0, 0, 0);"><span style="font-size:130%;">sometimes you need to bubble an event from Web User Control to a Web page may be do display certain items on Web Page according to which event is fired in this User control,<br /><br />let's try this with simple example<br /><br />Example<br /><br />in this example we have<br /> - Web User Control which contains two Buttons.<br /> - Web Page which contains this Web User Control.<br /><br />Task: we want to know which Button (from the two Buttons the Web User Control) is clicked.<br /><br />Let’s start:<br /><br />1- create a new Web Site.<br />2- Add a new User Control.<br />3- Add two Buttons to this User Control.<br /><img src="http://www.weblog.com/files/members/15602/UserControl.JPG" /><br /><br />4- Now let's switch to code<br /><br /></span><!--[if gte vml 1]><v:shapetype id="_x0000_t75" coordsize="21600,21600" spt="75" preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"> <v:stroke joinstyle="miter"> <v:formulas> <v:f eqn="if lineDrawn pixelLineWidth 0"> <v:f eqn="sum @0 1 0"> <v:f eqn="sum 0 0 @1"> <v:f eqn="prod @2 1 2"> <v:f eqn="prod @3 21600 pixelWidth"> <v:f eqn="prod @3 21600 pixelHeight"> <v:f eqn="sum @0 0 1"> <v:f eqn="prod @6 1 2"> <v:f eqn="prod @7 21600 pixelWidth"> <v:f eqn="sum @8 21600 0"> <v:f eqn="prod @7 21600 pixelHeight"> <v:f eqn="sum @10 21600 0"> </v:formulas> <v:path extrusionok="f" gradientshapeok="t" connecttype="rect"> <o:lock ext="edit" aspectratio="t"> </v:shapetype><v:shape id="_x0000_i1025" type="#_x0000_t75" alt="" style="'width:2in;"> <v:imagedata src="file:///C:\DOCUME~1\MomOn\LOCALS~1\Temp\msohtml1\01\clip_image001.jpg" href="http://www.weblog.com/files/members/15602/UserControl.JPG"> </v:shape><![endif]--><!--[if !vml]--><!--[endif]--><span style="font-size:130%;"> public delegate void WhichButton(string ButtonID);<br />public event WhichButton WhichButtonEvent;</span></p> <p class="MsoNormal" style="font-family: arial; color: rgb(0, 0, 0);"><span style="font-size:130%;">Let’s first speak about events and delegates in brief:</span></p> <p class="MsoNormal" style="font-family: arial; color: rgb(0, 0, 0);"><span style="font-size:130%;">-If a certain action occurred and you want a message to announce that, then event is that Message and as usual there should be a sender and receiver.</span></p> <p class="MsoNormal" style="font-family: arial; color: rgb(0, 0, 0);"><span style="font-size:130%;">-The object which raises this event is the sender and the object which captures this event is the receiver.</span></p> <p class="MsoNormal" style="font-family: arial; color: rgb(0, 0, 0);"><span style="font-size:130%;">-so far we just know that there is a sender and a receiver but what about the communication between them? How does the sender know which object or method will receiver the raised event? To solve this issue we just need a delegate which is a function pointer and will point to the function (receiver) which only matches its signature.</span></p> <p class="MsoNormal" style="font-family: arial; color: rgb(0, 0, 0);"><span style="font-size:130%;">If you need to know more about events and delegates </span></p> <p class="MsoNormal" style="font-family: arial; color: rgb(0, 0, 0);"><span style="font-size:130%;">Now back to our code, we define the delegate which point to a function that returns void and take string as a parameter, then we declared the event object which will act like the message which will be sent to the function which is the receiver.</span></p> <p class="MsoNormal" style="font-family: arial; color: rgb(0, 0, 0);"><span style="font-size:130%;">5- Now let's add the following lines of code in the Click event of both buttons.</span></p> <p class="MsoNormal" style="font-family: arial; color: rgb(0, 0, 0);"><span style="font-size:130%;"> if (WhichButtonEvent != null)<br /> {<br /> WhichButtonEvent(((sender)as Button).ID );<br /> }</span></p> <p style="font-family: arial; color: rgb(0, 0, 0);" class="MsoNormal"><span style="font-size:130%;">Here we set the string parameter to the ID of the button.<br /><br />Now our User Control is ready, let’s switch to our Web Page.<br /><br />6- Add a label to our Web Page.<br /><br />7-in Page_Load Event Add the following Code<br /><br /></span><span style="font-size:130%;">delegates1.WhichButtonEvent+=new delegates.WhichButton(delegates1_WhichButtonEvent);<br /></span><span style="font-size:130%;">where </span><span style="font-size:130%;">delegates1</span><span style="font-size:130%;"> is the User Control ID and </span><span style="font-size:130%;">delegates1_WhichButtonEvent<br /></span><span style="font-size:130%;">is the method which will act as the receiver and also it must match the signature of the function that is pointed to by the delegate (returns void and take one string parameter).<br /><br />8- now let's add this function<br /></span><span style="font-size:130%;">private void delegates1_WhichButtonEvent(string ButtonID)<br /> {<br /> Label1.Text = ButtonID;<br /> }</span><span style="font-size:130%;"><br />now this function receive the ID of the button which raise the event and will display it as the text of the label.<br /><br />9- Now run your code you will notice that after clicking any of the Buttons it's ID will be displayed on the label.<br /><br /><br /></span> <!--[if !supportLineBreakNewLine]--> <!--[endif]--></p> <p style="font-family: arial; color: rgb(0, 0, 0);" class="MsoNormal"><span style="font-size:130%;"><o:p> </o:p></span></p> <p style="font-family: arial; color: rgb(0, 0, 0);" class="MsoNormal"><span style="font-size:130%;"><o:p> </o:p></span></p>monahttp://www.blogger.com/profile/06677854988036291962noreply@blogger.com1tag:blogger.com,1999:blog-4793069445331811147.post-62697904756511686912008-06-17T11:44:00.000-07:002008-10-13T07:16:02.923-07:00Notes to know about UpdatePanel<span style="color: rgb(0, 0, 0);font-size:130%;" ><span style="font-family: arial;">these are few notes you should know about UpdatePanel</span><br /><br /></span><ol style="font-family: arial; color: rgb(0, 0, 0);"><span style="font-size:130%;"><br /></span><li><span style="font-size:130%;">you can use Updatepanel to provide partial page rendering in other words it can be used to update only certain part/s from the page instead of updating the whole page.</span></li><span style="font-size:130%;"><br /><br /></span><li><span style="font-size:130%;">updatepanel will be updated if any of the postback controls inside it is rendered.also Updatepanel can be refreshed from out side controls by adding triggers.</span></li><span style="font-size:130%;"><br /><br /></span><li><span style="font-size:130%;"> if you set the UpdateMode of the Updatepanel to Conditional and the postback Controls that are supposed to update the Updatepanel are all inside the updatepanel then there in no need to add trigers for these controls because the property ChildrenasTrigers is set bydefault to true.</span></li><span style="font-size:130%;"><br /><br /></span><li><span style="font-size:130%;">If you are using nested Updatepanels set the UpdateMode for both the outer panel and the inner pannels to Conditional.<br /></span><ul><span style="font-size:130%;"><br /></span> <li><span style="font-size:130%;">If Outer panel is refreshed then all the inner panels will be refreshed too.</span></li> <span style="font-size:130%;"><br /></span><li><span style="font-size:130%;">If any of the inner Updatepanels is refreshed the Outer updatepanel will not be refreshed.</span></li> <span style="font-size:130%;"><br /></span></ul></li><span style="font-size:130%;"><br /></span><li><span style="font-size:130%;">If the ChildrenAsTriggers property is set to false and the UpdateMode property is set to Always, an exception is thrown</span></li><span style="font-size:130%;"><br /></span></ol>monahttp://www.blogger.com/profile/06677854988036291962noreply@blogger.com1