Click here to Skip to main content
15,910,886 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
XML
<div id="MSGd" style="display: none" class="topline bottomline leftline rightline centered">  
<div class="bodytext" align="left">
  <table id="lst1" width="700"cellpadding="0" cellspacing="0" border="0">

    <tr>
        <td align="left" class="bottomline">
            <div class="bodytext">
                P.I.D
            </div>
        </td>
        <td align="left" class="bottomline">
            <asp:TextBox ID="txtpid" runat="server" MaxLength="20" Width="150"></asp:TextBox>
            <%--<asp:Button ID="btnpid" runat="server" Width="30" Text="pid" OnClick="btnpid_Click" bac CssClass="style=ba" />--%>
            <asp:ImageButton ID="btnpid" runat="server"  OnClick="btnpid_Click" ImageUrl="~/App_Themes/DISHA/Images/search-icon.gif" />
        </td>
                        <td align="left" class="bottomline">
                            <div class="bodytext">
                                Patient Name
                            </div>
                        </td>
                        <td align="left" class="bottomline">
                            <asp:TextBox ID="txtpatientname" runat="server" MaxLength="20" Width="150"></asp:TextBox><span
                                style="color: #ff0033">*</span>
                        </td>
                    </tr>

On click of btnpid button I called a stored procedure.
C#
ds = BFB.fn_Get_PID(txtpid.Text);

if (ds.Tables[0].Rows.Count > 0)
{
    txtmobile.Text = ds.Tables[0].Rows[0]["MobileNo"].ToString();
    txtpatientname.Text = ds.Tables[0].Rows[0]["Fname"].ToString();
    txtguardiansname.Text = ds.Tables[0].Rows[0]["FatherName"].ToString();
    txtphone.Text = ds.Tables[0].Rows[0]["PhoneNo"].ToString();
    ddlsex.SelectedValue = ds.Tables[0].Rows[0]["sex"].ToString();
    txtday.Text = ds.Tables[0].Rows[0]["Age"].ToString();
}

Every thing work fine but the only problem is Div MSGd get hide after click of btnpid
Posted
v3

1 solution

On button click, the Page will PostBack, so the Page will load again with the defined controls and its properties.

As I can see there is a style="display: none" property defined on div MSGd, so it is getting hided.

Please check the flow of Page and try to show it at the correct place inside or after this button click event.
 
Share this answer
 
Comments
Member 8233601 29-May-13 6:35am    
Page.RegisterStartupScript("OnLoad", "<script>Divshow();</script>");

function Divshow()
{
document.getElementById('MSGd').style.display = "block";
}
bt it's not working
please suggest me any solution i m need
Where are you adding this Page.RegisterStartupScript(), on Button Click event ?
Member 8233601 29-May-13 6:48am    
end of this event
You can do it easily in javaScript... Why don't you try that.

Call this Divshow() onClientClick event of Button.
Member 8233601 29-May-13 7:27am    
sir onclientside event took first and then server side event occur. hows is possible

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900