[RESOLVED] Programmatically hidden controls are visible until the page is fully loaded! How to fix !

Hi all,

I have a master page with few main controls i.e. content place holders, header, footer, ...
I'm hiding some of the controls on one of my pages at the page load. When I view the page in the browser it first loads all the controls including the one I've hidden in the code behind of the content page and then when the page is fully loaded hides them. So the user can see everything for about a couple of seconds before the final view is shown.

Is there any way I can control that? Is there any where else I can put the code that hides the controls of the master page?
I kinda want the page to be blank until it's fully loaded.

Thanks for any help 

 

Instead.. you can show the loading .. or progress bar while the page loads, below is the sample code:

<p>&nbsp;</p>
<pre class="xhtml:nogutter" name="code">&lt;html&gt;
&lt;head&gt;
&lt;/head&gt;
&lt;body onload="init()"&gt;
&lt;div id="loading" style="position:absolute; width:100%; text-align:center; top:300px;"&gt;Loading...&lt;/div&gt;
&lt;script type="text/javascript"&gt;
    var ld = (document.all);

    var ns4 = document.layers;
    var ns6 = document.getElementById &amp;&amp; !document.all;
    var ie4 = document.all;

    if (ns4)
        ld = document.loading;
    else if (ns6)
        ld = document.getElementById("loading").style;
    else if (ie4)
        ld = document.all.loading.style;

    function init() {
        if (ns4) { ld.visibility = "hidden"; }
        else if (ns6 || ie4) ld.display = "none";
    }
&lt;/script&gt;

Your page context begins from here
&lt;img src="http://www.reconn.us/demo/images/shell.jpg" /&gt;
&lt;img src="http://www.reconn.us/demo/images/shell.jpg" /&gt;
&lt;img src="http://www.reconn.us/demo/images/shell.jpg" /&gt;

&lt;/body&gt;
&lt;/html&gt;</pre>
<p><br /><br /></p>
<p>&nbsp;</p>
 

Thanks for the code, cool stuff but didn't fix my problem!
I could get around it with setting the visibility in the javascript. 

hi,

please post your code.thats use ful to other can give the solution correctly..

 

thank you,

Arunabathan.G

Change web part title bar color

I am creating web parts in C# code in my ASP.NET app with the WebPartManager.CreateWebPart method.  How can I set the color of the bar at the top of each web part where the Title is shown?  This bar is rendered as a <TD> tag like this:

<td id="WebPartTitle_wp921482890" style="width:100%;white-space:nowrap;">

You can do it in the skin file, e.g.

<asp:WebPartZone runat="server" BorderStyle="None" Padding="0" CssClass="WebPartZone" LayoutOrientation="Vertical" width="100%">
    <HeaderStyle CssClass="WebPartZoneHeader" />
    <PartTitleStyle CssClass="WebPartTitle" BorderStyle="None" />
    <PartStyle CssClass="WebPart" BorderStyle="None" />
    <PartChromeStyle CssClass="WebPartChrome" BorderStyle="Solid" BorderColor="#015ab3" BorderWidth="1"  />
    <CloseVerb enabled="false" visible="false" />
    <RestoreVerb enabled="false" />
    <MinimizeVerb enabled="false" visible="false" />
    <EditVerb enabled="false" />
    <MenuPopupStyle />
</asp:WebPartZone>

Out of the box, you can only change the style of the WebPartChrome for all the WebParts in a WebPartZone, not for an individual WebPart within the WebPartZone.  You can change the color of the title bar using the WebPartZone.PartTitleStyle.BackColor property.

-Mike

does anyone have any idea how an individual webpart could be styled? From a design point of view I belive this is quite desireable!

I am having same problem.Please notify me if you find the solution.

 

[RESOLVED] retrieve value of hidden fields

Hi all, may i know how can i retrieve value of hidden fields from page1.aspx in page2.aspx

My button in page1.aspx

Protected Sub btn_submit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_submit.Click

    Me.HiddenField1.Value = "Testing"
    Response.Redirect("page2.aspx")

End Sub

<div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow: hidden;" class="mcePaste" id="_mcePaste"></div>

you can use PreviousPage property and then find control method to find control and then take values out

link for more details:

 

http://msdn.microsoft.com/en-us/library/ms178139.aspx

 

 

Hope this answer your question


Please mark as answer if this solve your problem

DevTechie.com

PreviousPage.FindControl(hiddenfieldid).value
When you do a response.redirect the previous page is lost from the context. If you want to use the control of the previous page you will have to do a server.transfer. This problem is better sovled in Asp.net 2.0 by using the PostBackUrl which is a property of IButtonControl Interface. for more information refer http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.ibuttoncontrol.postbackurl.aspx http://msdn.microsoft.com/en-us/library/ms178139.aspx

Hi All, what if i want to post to another website like https://www.abc.com/entry.aspx with hidden fields value?

this is my original code...how can i change it under codebehind

<body>
<form id="form1" runat="server" action="https://www.abc.com/entry.aspx">
<table class="black_text">
<tr><td>
    <%
        Dim RefNo As String = Me.txt_order_no.Text
     %>
    <form method="post" name="ePayment" action="https://www.abc.com/entry.asp">
    <input type="hidden" name="RefNo" value="<%=RefNo%>" />
    <input type="submit" value="Proceed with Payment" name="Submit" id="Submit" />
    </form>
    </td></tr>
    <tr><td>
        <table>
            <tr>
                <td><asp:Label ID="Label6" runat="server" Text="Reference No."></asp:Label></td>
                <td><asp:TextBox ID="txt_order_no" runat="server" Width="200px"></asp:TextBox></td>
            </tr>
        </table>
    </td></tr>
</table>
</form>
</body>

since you are posting the page to url which is out of the application context the hidden field will not be available directly. You will have to acces them using the request object or pass it through the query string.

hi,

 if you want to pass only page1.aspx to page2.aspx means set PreviousPage url to page2.aspx as page1.aspx. then you can access the hiddenfiled value using this line PreviousPage.FindControl(hiddenfieldid).value. suppose you want to pass that hidden value to all page means use querystring,Session or cookie..

Thank You,

Arunabathan.G

[RESOLVED] Creating Email & sending

Starting a web project which user fills out information, the infomation will be stored in a table.  Not only do need to store the data, need also to create an email in a report form and email to several receipents.  The receipents email addresses will be pulled from a table depending on options selected from the screen. 

Have never does this and I am not really sure where to start.  Have seen several options on web put still little confused the best way to go about it.  Will be using ASP.NET and VB.NET or C# for code behind.Undecided

Any suggestions would be greatly appreciated!

 

Check out the link below to see how you can save the data entered by the user
http://www.asp.net/data-access/tutorials#Editing, Inserting, and Deleting Data

To send email you can use the following code.


using System.Net.Mail;

public void SendMail()
{
    MailAddress FromMailAddress = new MailAddress("sender@somedomain.com");
    MailAddress ToMailAddress = new MailAddress("recipient@somedomain.com");
    MailMessage MailMsg = new MailMessage();
    MailMsg.From = FromMailAddress;
    MailMsg.To.Add(ToMailAddress);
    MailMsg.Subject = "Some subject for the email";

    MailMsg.Body = @"
        <html>
            <body>
                <b>Heading</b><br>
                <br>
                Some Text<br>
                Again Some Text<br>
            </body>
        </html>"
;

    MailMsg.IsBodyHtml = true;

    SmtpClient MailSender = new SmtpClient("SMTP Server Address");
    MailSender.Send(MailMsg);
}

 

To get the data and edit it, use SqlDataSource with GridVew - 

http://csharpdotnetfreak.blogspot.com/2009/05/gridview-sqldatasource-insert-edit.html

To send email - 

http://systemnetmail.com/

Thanks.

Thanks sooo much! This is what I had in mind.

[RESOLVED] Using multiple validation controls on the same control

Hi,

I am trying to apply both a required validator and a regex validator to a text box, and I am using a * beside the textbox to signify an error.  But the required validator * takes up it's own space so when the validation passes for the required element but fails the regex, the * displays further to the right of the text box than I want it to.  Is there anyway to make these both display in the same place? Here is my code :

<asp:TextBox ID="txtTelephoneNumber" runat="server" />
                        <asp:RequiredFieldValidator ID="valTelephoneNumber" runat="server"
						ErrorMessage="Please enter a Telephone Number" Font-Bold="true"
						ControlToValidate="txtTelephoneNumber">*</asp:RequiredFieldValidator>
						<asp:RegularExpressionValidator id="valTelephoneNumberRegEx"
						ControlToValidate="txtTelephoneNumber"
						Font-Bold="true"
						ErrorMessage="Telephone Number must contain only numbers, + and -"
						ValidationExpression="^[0-9\-\+]+$" runat="server">
						*
						</asp:RegularExpressionValidator>

Hi,

you can set the Display property of both validation controls to Dynamic.

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.basevalidator.display.aspx.

Display behavior

Description

None

The validation message is never displayed inline.

Static

Space for the validation message is allocated in the page layout.

Dynamic

Space for the validation message is dynamically added to the page if validation fails.

Grz, Kris.

Hello,

Try validation summary and put text property of the required and regular experssion to "*" insted of written between tag.

Hi

 

You can also go for custom validations