|
In a C# 2010 web form application, I want to maintain the scroll bar position in Panel1 listeb below. According to the following
link: http://gnidesign.blogspot.com/2011/06/how-to-maintain-page-scroll-on-postback.html, the javascript code that I supplied below
should work. My problem is there is not a 'head' html tag for me to embed the javascript code into.
Thus can you tell me what is wrong with the Javascript code I have below? Do I have the code in the wrong postion of the *.aspx
page?
Can you tell me how to maintain the scrollbar position of panel1?
Here is the code I am referring to:
<%@ Page Title="" Language="C#" MasterPageFile="~/App.Master" AutoEventWireup="true" MaintainScrollPositionOnPostback="true"
CodeBehind="Atts.aspx.cs" Inherits="RpcSupport.Atts" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="TopMenu" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ReportForm" runat="server">
<ajx:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" EnablePartialRendering="true">
</ajx:ToolkitScriptManager>
<asp:UpdatePanel ID="AttUploadUpdatePanel" runat="server">
<ContentTemplate>
<table style="width: 100%;">
<tr>
<td>
<table style="width: 50%;">
<tr>
<td width="100px" rowspan="5">
</td>
</tr>
</table>
</td>
<asp:Table ID="uploadAtttb" runat="server" Height="35px" HorizontalAlign="Center"
Width="50%">
<asp:TableRow ID="trTitle" runat="server" HorizontalAlign="Center">
<asp:TableCell ID="TableCell1" runat="server" RowSpan="1" ColumnSpan="5" VerticalAlign="Top" HorizontalAlign="Center">
<asp:Label ID="Label1" runat="server" CssClass="RptPageTitle" Text="Att Entry" />
</asp:TableCell></asp:TableRow><asp:TableRow ID="TableRow1" runat="server">
<asp:TableCell ID="TableCell2" runat="server" RowSpan="1" ColumnSpan="5" VerticalAlign="Top" HorizontalAlign="Center">
<asp:Label ID="lblResultMsg" runat="server" CssClass="msgStyle" />
<asp:Label ID="lblErrorMsg" runat="server" CssClass="errorStyle" />
</asp:TableCell></asp:TableRow><asp:TableRow ID="TableRow2" runat="server">
<asp:TableCell ID="TableCell3" runat="server" HorizontalAlign="Right">
<asp:Label ID="Lable2" runat="server" Text="Org Name" CssClass="RptFormLabel" />
</asp:TableCell><asp:TableCell ID="TableCell4" runat="server" HorizontalAlign="Left" AutoPostBack="true">
<asp:TextBox ID="txtOrgID" Visible="false" Enabled="true" runat="server" Width="100"
MaxLength="10" />
<asp:TextBox ID="txtOrgName" runat="server" Width="250" CssClass="TextBoxStyle" OnTextChanged="FindOrg"
AutoPostBack="true" MaxLength="100" />
<ajx:AutoCompleteExtender ID="AutoCompleteAtt" runat="server" CompletionListCssClass="AjaxListStyle"
TargetControlID="txtOrgName" ServiceMethod="GetOrgAttList" ServicePath="Atts.aspx"
MinimumPrefixLength="1" CompletionInterval="200" CompletionSetCount="50">
</ajx:AutoCompleteExtender>
</asp:TableCell></asp:TableRow><asp:TableRow ID="TableRowa" runat="server" Visible="true">
</asp:TableRow>
<asp:TableRow ID="TableRowb" runat="server" Visible="true">
<asp:TableCell ID="TableCell5" runat="server" HorizontalAlign="right">
</asp:TableCell><asp:TableCell ID="TableCell5a" runat="server" HorizontalAlign="left">
<asp:Panel ID="Panel2" runat="server" CssClass="TextBoxStyle" GroupingText="Compoany Number and Name">
<asp:Panel ID="Panel1" runat="server" ScrollBars="Auto" Height="130px" Width="455"
CssClass="TextBoxStyle">
<asp:CheckBoxList ID="ChkBoxLstPlan" runat="server" >
</asp:CheckBoxList>
</asp:Panel>
</asp:Panel>
<div>
<asp:RequiredFieldValidator CssClass="errorStyle" ID="reqVal1" Display="Dynamic"
runat="server" ControlToValidate="txtOrgName" ErrorMessage="'Organization Name' is a required field." />
</div>
</asp:TableCell></asp:TableRow></asp:Table></tr></table></ContentTemplate>
</asp:UpdatePanel></asp:Content><asp:Content ID="Content5" ContentPlaceHolderID="ReportBody" runat="server">
<script type="text/javascript">
window.scrollTo = function () { }
</script>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="Footer" runat="server">
</asp:Content>
|
|
|
|
|
sc steinhayse wrote: maintain the scroll bar position
div scroll
sc steinhayse wrote: how-to-maintain-page-scroll-on-postback.html,
page scroll
[Action]
Your reference material is for page scroll, the entire page on the browser.
You should search for panel or div scroll, or perhaps overflow scroll
I don't know off hand how to do that, but your code won't work on a div element
[EDIT]
I was just looking at your webform, I can't see how that would even work or render into proper html.
You missing a form tag, so form events will not occur, your missing a body tag
This master page was handy, I stripped out irreverent information. But if you look closely, you'll see that a webform or even a master page, is just a html page designed for graphics and looks. You make areas or spaces that you can insert content into, called contentPlaceHolder's.
OK, so your going to tell me that your master page is very advanced, and that you inserted the proper tags in the contentPlaceHolders, and that everything is fine. There are no problems with the masterpage and webform.
Fine!
But that sample will not render or function correctly.
Now I see why you can't things to work, it's because you don't have the basic understanding of how HTML works. I would hate to be the guy that has to modify your markup.
All in all, at least you posted some markup, which is brave and good. Now you just need to step back a day, and take a lesson in HTML, and then move forward.
Notice how I don't use asp.net objects for everything, I just use regular HTML tags. You only use them when you absolutely have to. They are not worth the time to use, unless you need them in code-behind to create elements.
<%@ Master Language="VB" AutoEventWireup="false" CodeFile="EN-US_Landing.master.vb" Inherits="EN_US_Landing" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head runat="server">
<title></title>
<meta http-equiv="cache-control" content="no-cache" />
<link href="/CSS/EN-US_Custom1.css" rel="stylesheet" type="text/css" />
<link href="/CSS/EN-US_Footer.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
<asp:ContentPlaceHolder ID="HeadContent" runat="server">
</asp:ContentPlaceHolder>
</head>
<body id="bodytag" runat="server" class="PageBackground">
<form runat="server" id="frmDefault">
<ajax:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" />
<div id="LandingHeader_Wrapper_III" >
<div id="DocumentBackground_Body_Black">
<div class="DocumentBackground_Container_Black">
<table border="0" width="980" style="width:980px;">
<tr>
<td colspan="2" style="width: 980px;">
<asp:ContentPlaceHolder ID="HighContent" runat="server">
</asp:ContentPlaceHolder>
</td>
</tr>
</table>
<table border="0" width="980" style="width:980px;">
<tr>
<td valign="top" style="width: 980px;">
<asp:ContentPlaceHolder ID="LowContent" runat="server">
</asp:ContentPlaceHolder>
</td>
</tr>
</table>
</div>
</div>
</div>
</form>
</body>
</html>
|
|
|
|
|
The web pages you are looking at are part of the company website. I am using the same master pages that the entire company is using. All the login and inheritance between the different web form pages are obtained from the master web pages.
Content place holder 4 is where all the other web pages place their unique elements items for the web page. Thus I did the same thing. is that wrong?
|
|
|
|
|
As far as it being wrong, it's a matter of style, function and ease of updating.
It's just my opinion, your free to do whatever you want with your skills.
If anyone has any input on this, fell free to fire away.
|
|
|
|
|
In a C# 2010 web application, I have a regular expression validator that validates if a date is in mm/dd/yyyy format. The control works fine however the message quickly appears when the user enters the date and goes away. The message also appears when the user clicks the next button. I only want the message to appear when the user clicks the 'next' button.
The following is my code:
<div> <asp:RegularExpressionValidator ID="RegExpresValdate" runat="server" ControlToValidate="txtDate" CssClass="errorStyle"
ValidationExpression="^(0[1-9]|1[012])[/](0[1-9]|[12][0-9]|3[01])[/](19|20)\d\d$"
ErrorMessage="Please enter date in valid format (mm/dd/yyyy).">
</asp:RegularExpressionValidator>
</div>
Can you tell me what I can do to have the message only display when the user clicks the next button?
|
|
|
|
|
|
I can setup validation group for all the controls. However, how will that help here?
|
|
|
|
|
i want to know how can I make the footer row at the bottom of the page even if the content is less? I tried this code but the footer is still not coming the bottom?
<asp:Table ID="Table1" runat="server" BorderWidth="1" CellPadding="5" Width="960px" Height="100%" HorizontalAlign="Center">
<asp:TableRow>
<asp:TableCell HorizontalAlign="Center"><uc1:website_header ID="websiteHeader" runat="server" /></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell><uc1:main_menu ID="mnuMain" runat="server" /></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell><asp:ContentPlaceHolder ID="MainContent" runat="server"/></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell HorizontalAlign="Center" bottom:0px;"><uc1:Website_footer ID="Website_footer" runat="server" /></asp:TableCell>
</asp:TableRow>
</asp:Table>
|
|
|
|
|
how to register ASP.Net webform route when the url pattern and physical file is not available in registeration time. What I need to do is get the site url and check the database to find the physical file and the query string.
If I use routes.MapPageRoute("AllURLs", "{*page}", destinationUrl) I don't know how to get the destinationUrl from database for the requested url?
I hope this is clear. Please help me.
|
|
|
|
|
I don't understand the database part.
Are you going back to a SQL Server Database, to fetch data?
In asp.net 4.0, you build a route table, and store it in the global.asax, or you can store the table and rules in a class file, and point to the class in the global.asax.
The route table contains the rules to build the routes, when users access the website, and contains the rules to create the routes, for creating internal links.
Now you have to hook it up to IIS7+ in order to get it to work. You have load a module to support routing I believe.
If my memory serves me correct, asp.net 4.0 routing only works on Windows Vista and Windows 7, or IIS7 and IIS7.5 and up.
I don't have any route maps handy at the moment, because I already have some huge project loaded at the moment.
|
|
|
|
|
Please help me on my issue below;
I am working on an application to replace URLRewrite with ASP.Net 4 Routing. The requirement is to get the context.Request.RawURL runtime and check the URL in the database to find the physical file (ASPX form) and render that page.
This is what I have done but not sure how to render the page without redirection.
public class WebFormRouteHandler : IRouteHandler
{
public System.Web.IHttpHandler GetHttpHandler(RequestContext requestContext)
{
return new WebFormHandler();
}
}
public class WebFormHandler : IHttpHandler
{
public bool IsReusable
{
get { return true; }
}
public void ProcessRequest(HttpContext context)
{
string url = context.Request.RawUrl;
var destinationURL = GetFromDatabase(url);
context.Response.StatusCode = 301;
context.Response.AppendHeader("Location", destinationUrl);
return;
}
}
And In global.asax.cs :
public static void RegisterRoutes(RouteCollection routes)
{
var route = new Route("{language}/{*page}", new WebFormRouteHandler());
routes.Add(name, route);
return route;
}
So I want to get the requested URL and look at the database to get the physical file. The physical file may come with query strings. The way I have done above is not good because I am redirecting and mainly it doesn't work.
Please help.
|
|
|
|
|
I want to send sms through asp.net. Can anybody give me working code please.I want it urgent
|
|
|
|
|
You will have to use a sms gateway. That's your first step. After that you will have to read their api documentation to figure out how to create the code you need. Sms gateway providers have different api's so it's impossible to help you with code before you choose which gateway to use. Google "sms gateway api"
--------------------
When Chuck Norris' dreams come true, your worst nightmares begin.
|
|
|
|
|
You have posted this question in three forums; please read How to get an answer to your question[^], and post in one forum only.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Countered the 1 vote
C# has already designed away most of the tedium of C++.
|
|
|
|
|
Thanks, amazing how angry some people get when we won't do their work for them.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
To send sms though code you will need some third party sms gateway provider.
the code will differ for all the service providers but it will be very simple and the integration will be matter of minutes. I suggest you try to find some third party sms gateway provider that fits your needs and then implement the functionality as per its API.
Every now and then say, "What the Elephant." "What the Elephant" gives you freedom. Freedom brings opportunity. Opportunity makes your future.
|
|
|
|
|
you need to buy sms pack from like www.smsgatewaycenter.com these websites also provide developer code you have just to apply it
you need to search first
|
|
|
|
|
At my company I am told that I need to setup a web service with an 'xsd' file I will be receiving tomorrow morning. I have a visual studio.net 2010 professional version development software to work with and I have experience using C# 2010.
Since I have not setup a web service before, I am wondering how to setup the web service from scratch? All I want to do is have the web service that only works with the *.xsd file.
Thus can you tell me and/or point me to a reference on how to setup this web service?
|
|
|
|
|
hello
i published my website and hosted on IIS.when i run the site as http://localhost/employee/emp.aspx ,every thing goes fine.it displays the page.
But when i run it using my system ip address as http://10.40.5.140/employee/emp.aspx , it displays
'You are not authorized to view this page
You do not have permission to view this directory or page using the credentials that you supplied.
Please try the following:
Contact the Web site administrator if you believe you should be able to view this directory or page.
Click the Refresh button to try again with different credentials.
HTTP Error 401.1 - Unauthorized: Access is denied due to invalid credentials.
Internet Information Services (IIS)
Technical Information (for support personnel)
Go to Microsoft Product Support Services and perform a title search for the words HTTP and 401.
Open IIS Help, which is accessible in IIS Manager (inetmgr), and search for topics titled Authentication, Access Control, and About Custom Error Messages.'
how to run i using my system ip address.
thank you.
|
|
|
|
|
|
How to populate data table in to jqgrid ? ? please help
Using Webservice or any other method?
|
|
|
|
|
The following is the code for combobox along with its custom validator
<asp:ComboBox ID="cmbBusinessOwner" runat="server" MaxLength="0" DropDownStyle="DropDownList"
AutoCompleteMode="SuggestAppend">
<asp:ListItem Text="--Select--" Value="0" />
<asp:ListItem Text="HDFC Co-op" Value="1" />
<asp:ListItem Text="Limited Dividend Co-op" Value="2" />
<asp:ListItem Text="Rent Controlled" Value="3" />
<asp:ListItem Text="Rent Stablized" Value="4" />
<asp:ListItem Text="India" Value="5" />
<asp:ListItem Text="United" Value="6" />
<asp:ListItem Text="America" Value="7" />
<asp:ListItem Text="Mexico" Value="8" />
</asp:ComboBox>
<asp:CustomValidator ID="cvRequired" runat="server" ValidationGroup="Continue" ForeColor="Red"
ClientValidationFunction="cvComboBox_Validate" Text="Select Business Owner" Display="Dynamic"></asp:CustomValidator>
the script for cvComboBox_Validate function is
function cvComboBox_Validate(source, args) {
var ComboBoxCtrl = $find('cmbBusinessOwner');
if (ComboBoxCtrl.get_textBoxControl().value == "--Select--")
args.IsValid = false;
else
args.IsValid = true;
}
This code gives me the error message "Select Business Owner" next to the control on button click. But the message "Select Business Owner" fails to appear in validation summary.
My validation summary is as follows
<asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="false" EnableClientScript="true"
CssClass="validationsummary" ValidationGroup="Continue" DisplayMode="BulletList"
HeaderText="<div class='validationheader'> Please correct the following errors:</div>" />
Rest all the control on the page works fine except for this combobox.
Help will be greatly appreciated.
Thanks
|
|
|
|
|
It's been over 5 years since I've used one of those valicators, but on a dropdownlist, you have to add the default value to the validator for it to work on a dropdownlist. I don't remember the exact use, but I think it's
<asp:CustomValidator ID="cvRequired" runat="server" ValidationGroup="Continue" ForeColor="Red" defaultvalue="0"
ClientValidationFunction="cvComboBox_Validate" Text="Select Business Owner" Display="Dynamic"></asp:CustomValidator>
Without the default value, the validator has no clue what to validate.
|
|
|
|
|
Thanks for the reply.
The defaultvalue="0" does not work either.
The problem isn't that the validation does not work. It works fine. I see the message displayed next to the combobox control on button click.
The issue is that the validationsummary does not capture this custom validator.
|
|
|
|