Friday 24 May 2013

how to create modalpopup and display popup in Detailview in asp.net

Introduction:-


                  In this Example we explain that How to use modalpopup in our WebApplication are Described Here.


Description:-


                        The ModalPopupExtender allows Users to Display Content of Element into the Popup. When Popup is Show at that popup is Display with HighLight and User are not allowed to do any other operation even the click on the other Control are not permitted.

You can provide OnShowing/OnHiding/OnHidden animations which are played when the modalPopupExtender  content is shown and hidden.


Property of the ModalPopupExtender:-
  TargetControlID - The ID of the  activates the modal popup.
  PopupControlID - The ID of the element to display as a modal popup like Button etc….
  BackgroundCssClass - The CSS class for Popup to apply to the background when the modal popup is displayed.
  DropShadow - True to automatically add a dropshadow to the modal popup.
  OkControlID - The ID of the element that dismisses the modal popup.
  OnOkScript - The script to run when the modal popup is dismissed using the element specified in OkControlID.
  CancelControlID - The ID of the Control that cancels the modal popup
  OnCancelScript - Script to run when the modal popup is dismissed with the CancelControlID
  PopupDragHandleControlID - The ID of the embedded element that contains the popup header/title which will be used as a drag handle
  X - The X coordinate of the top/left corner of the modal popup (the popup will be centered horizontally if not specified)
  Y - The Y coordinate of the top/left corner of the modal popup (the popup will be centered vertically if not specified)
  RepositionMode - The setting that determines if the popup needs to be repositioned when the window is resized or scrolled.


Methods
  • initialize() - Initializes the ModalPopupExtender behavior.
  • dipose() – Disposes or End the ModalPopupExtender behavior.
  • show() - Displays the element that is referenced by the PopupControlID property as a modalpopup dialog box.
  • disableTab() - Changes the tab indexes so that tabbing moves the focus only through the modal dialog box.
    • Remarks - In Internet Explorer 6, the disableTab method also hides the select elements.
  • restoreTab() - Restores the tab indexes from the page.
    • Remarks - In Internet Explorer 6, the restoreTab method also restores the select elements.
  • hide() - Hides the modal popup.
    • Returns - Returns a Boolean value that specifies whether the popup was hidden.


How to Send SMS to user in asp.net Send SMS to users mobile

Rotate the Ads or Advertisement in webpage Rotate Ads without refreshing the page

to show Example of Password Strength Extender click Here Password Strength in Ajax with Asp.Net


Aspx Code:-

<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" Enabled="true" PopupControlID="mdltab"
                            BackgroundCssClass="modalBackground" TargetControlID="HiddenField1">
                        </cc1:ModalPopupExtender>
  <table id="mdltab" style="border: medium double #174453; height: auto; display: block;"
                            cellpadding="0" cellspacing="0">
                            <tr style="height: 30px; background-color: #4098B6;">
                                <td align="center" style="width: 192px; height: 11px;">
                                    <asp:Label ID="Label2" runat="server" Font-Bold="True" ForeColor="White" Text="Blood Sample Details"></asp:Label>
                                </td>
                                <td align="right">
                                    <asp:ImageButton ID="btn_popupexit" runat="server" ImageUrl="~/images/delete.png" />
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <asp:DetailsView ID="DetailsView1" runat="server" Height="50px" AutoGenerateRows="False"
                                        BorderColor="#174453" BorderStyle="Double" BorderWidth="3px" BackColor="AliceBlue">
                                        <FieldHeaderStyle Font-Bold="True" Width="160px" />
                                        <Fields>
                                            <asp:BoundField HeaderText="Donor Id" DataField="donorid" NullDisplayText="N/A"/>
                                            <asp:BoundField HeaderText="Donor Name" DataField="name" NullDisplayText="N/A"/>
                                            <asp:BoundField HeaderText="Sample Id" DataField="sampleid" NullDisplayText="N/A"/>
                                            <asp:BoundField HeaderText="Technician" DataField="firstname" NullDisplayText="N/A"/>
                                            <asp:BoundField HeaderText="FFP" DataField="ffp" NullDisplayText="N/A"/>
                                            <asp:BoundField HeaderText="Platelet" DataField="platelet" NullDisplayText="N/A"/>
                                            <asp:BoundField HeaderText="Packed RBC" DataField="packedrbc" NullDisplayText="N/A"/>
                                            <asp:BoundField HeaderText="Plasma" DataField="plasma" NullDisplayText="N/A"/>
                                            <asp:BoundField HeaderText="HIV" DataField="hlv" NullDisplayText="N/A"/>
                                            <asp:BoundField HeaderText="HBsAG" DataField="hbsag" NullDisplayText="N/A"/>
                                            <asp:BoundField HeaderText="HCV" DataField="hcv" NullDisplayText="N/A"/>
                                            <asp:BoundField HeaderText="VDRL" DataField="vdrl" NullDisplayText="N/A"/>
                                            <asp:BoundField HeaderText="MP" DataField="mp" NullDisplayText="N/A"/>
                                            <asp:BoundField HeaderText="HB" DataField="hb" NullDisplayText="N/A"/>
                                            <asp:BoundField HeaderText="Sample Status" DataField="samplestatus" NullDisplayText="N/A"/>
                                        </Fields>
                                    </asp:DetailsView>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>




Code Behind:-


protected void ViewDonorRecord(int pk_bloodsampletestid)
    {
        try
        {
            using (DataClassesDataContext database = new DataClassesDataContext())
            {
                var coll = (from smpltest in database.bb_BloodSampleTests
                            where smpltest.pk_bloodsampletestid == pk_bloodsampletestid && smpltest.fk_hospitalid == hospid

                            join tech in database.bb_TechnicianRegistrations on smpltest.fk_technicianregistrationid equals tech.pk_technicianregistrationid into smpltest_tech
                            from tech in smpltest_tech.DefaultIfEmpty()

                            join smplcoll in database.bb_BloodSampleCollections on smpltest.fk_bloodsampleid equals smplcoll.pk_samplecollectionid into smpltest_smplcoll
                            from smplcoll in smpltest_smplcoll.DefaultIfEmpty()

                            join dnreg in database.bb_DonorRegistrations on smplcoll.fk_donorregistrationid equals dnreg.pk_donorregistrationid into smplcoll_dnreg
                            from dnreg in smplcoll_dnreg.DefaultIfEmpty()

                            select new
                            {
                                dnreg.donorid,
                                dnreg.name,
                                smplcoll.sampleid,
                                tech.firstname,
                                smpltest.ffp,
                                smpltest.platelet,
                                smpltest.packedrbc,
                                smpltest.plasma,
                                smpltest.hlv,
                                smpltest.hbsag,
                                smpltest.hcv,
                                smpltest.vdrl,
                                smpltest.mp,
                                smpltest.hb,
                                smpltest.samplestatus
                            }).ToList();

                if (coll.Any())
                {
                    DetailsView1.DataSource = coll;
                    DetailsView1.DataBind();
                }
                else
                {
                    DetailsView1.DataSource = null;
                    DetailsView1.DataBind();
                }
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }

    }





0 comments:

Post a Comment