C# - Validation When Converting .aspx To .ascx?

Mar 22, 2010

I'm currently converting a set of .aspx pages and the VB code behind them to .ascx and C#.

Basically the system I'm working with validates a shopping basket but with me changing the class the code inherits from I'm having issues working out what I should change it too.

I'm changing from System.Web.UI.Page to System.Web.UI.UserControl and am primarily having problems with the Validator.Add(v) element of the code below:

public override void Validate()
{
base.Validate();
if (Profile.ShoppingCart == null || Profile.ShoppingCart.Items.Count == 0)
{
CustomValidator v = new CustomValidator();
v.ErrorMessage = "You must have at least 1 course in your basket.";
v.IsValid = false;
Validator.Add(v);
}
}

View 1 Replies


Similar Messages:

To Pass A Value From Ascx To Aspx?

Jan 12, 2010

I have a Menus user control and depending on which menu item the User clicks, the appropriate page is loaded by setting the hyperlink.NavigateUrl to the appropriate aspx page.I need to use the same page for 2 different menu items but I need to pass a value to the page so I know which data to load into it.Is there a way to pass the menu name or any other value from the usercontrol to the asp.net page?

View 12 Replies

Performance - Aspx Include Vs Ascx?

May 6, 2010

I have many aspx page includes in my web form. I want to convert them to user controls. Just wanted to confirm whether there is any performance gain in doing so? I have 50 pages in which the aspx page is included.

View 1 Replies

C# - ASCX And ASPX Transferring Data From One To The Other?

Mar 24, 2011

I have this page, shown below. In the ASCX file, the data is generated using a DataGrid in which a user searches for fields and it displays results based on input criteria. This is using a stored procedure and parameters to perform this search. It then returns the results, populates a datagrid, now my question is how would I go about in my ASPX page having my disk icon allow a user to download a CSV of the data that has been returned in the ASCX page. I obviously need to run a command to generate the CSV file from the database, which I have all the code for, but my question really is how do I know what the user has searched for, or what results were returned I guess best put.

View 3 Replies

Web Forms :: Refer To Label In Aspx From Ascx?

Oct 17, 2010

refer to label in aspx from ascx? .......

View 1 Replies

Web Forms :: Cannot Pass The Value From .ascx To .aspx Page

Oct 24, 2010

I have created a UserControl [uscAuditTeam.ascx], there I have a Dictionary list and I added some values.

I want to pass the dictionary value to AuditTracking.aspx page. But it shows the null value.

[Code]....

View 4 Replies

C# - How To Generate String From View (.aspx Or .ascx)

Mar 25, 2011

How can I get the resolved (<%%> resolved) view (aspx or ascx) in a string format? I want to have .ascx file with some <%= ... %> code blocks and I want to be able to send it as part of e-mail in HTML format. How can I do this with MVC?

View 3 Replies

Web Forms :: Code Works On Aspx But Not On Ascx

Aug 21, 2010

Not sure which category to put this question in, so I will put it in here. Just to give you an idea of the layout of my solution, I have the main project, along with 2 class libraries, BLL and DAL. (Business Logic Layer and Data Access Layer) The BLL refers to the DAL and the main project refers to the BLL. I had a test website and the code worked fine, but the same code will not work on the real project. The only difference is that in the test project, the code was on an aspx code behind, whereas in the real project, it is an ascx code behind (Web User Control

)

The code is:

[Code]....

Dim connectionString As String = ConfigurationManager.ConnectionStrings("ASPNETDBConnectionString").ConnectionString

View 5 Replies

Changes In Ascx / Aspx Files Will Reset Application?

Feb 16, 2011

Changes in ascx / aspx files - will it reset application? Sometimes on dev server they won't cause it whereas on live server I think it sometimes causes it. What is the rule?

View 3 Replies

Web Forms :: Is It Possible To Emebed An ASPX Page Into An ASCX Control

Jul 22, 2010

Is it possible to emebed an ASPX page into an ASCX control ?

View 1 Replies

C# - Accessing Control On Page A.ASPX From A WEBUSERCONTROL.ASCX?

Feb 2, 2011

How can I access a control on page a.aspx from a webusercontrol.ascx

I do not know the technical term used to describe this, if any,the webusercontrol.ascx page contains a button.

onclick of the button, placeholder on main page must display the "required content".

if this were on the same page no problem.

but how to access across pages?

View 1 Replies

Caching - ASPX And ASCX Files Not Updating When Saved?

Mar 4, 2011

At some point in the last month, two web application projects that I've been working on have stopped showing updates to aspx and ascx files until IIS is restarted, or the website they belong to is reset. This seems to be very random and I can't find any reason in the web.config sections that would cause this change. What are some good places to look for a source to this issue?Current caching parts of web.config: Removing the outputCacheProfile and restarting IIS made no difference.

<caching>
<outputCacheSettings>
<outputCacheProfiles>
<add name="ClientResourceCache" location="None" enabled="true" duration="3600" varyByParam="*" varyByContentEncoding="gzip;deflate"/>
</outputCacheProfiles>
</outputCacheSettings>
</caching>

Commening out the staticConent and restarting also made no difference

<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="1.00:00:00">
</clientCache>
</staticContent>
<caching>
<profiles>
<add extension=".gif" policy="DontCache" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />
<add extension=".png" policy="DontCache" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />
<add extension=".js" policy="DontCache" kernelCachePolicy="DontCache" duration="00:01:00" location="Any" />
<add extension=".css" policy="DontCache" kernelCachePolicy="DontCache" duration="00:01:00" location="Any" />
<add extension=".jpg" policy="DontCache" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />
<add extension=".jpeg" policy="DontCache" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />
</profiles>
</caching>

We've also tried adding .ascx and .aspx extensions with CacheUntilChange which made no difference. Other sites with these same settings aren't having the issue. Edit: Originally this state that there also was no update when the project was built, I haven't personally been able to confirm that issue but was told by another developer that was occurring.

View 2 Replies

Get Parameters Out Of An Ascx Back To Main Aspx Page?

Jun 15, 2010

I've got an aspx page that renders an ascx page with filtering capabilities. Inside the ascx page, parameters are passed as follows:

<tr>
<td class="label">Plataforma</td>
<td class="field lookup"><%= Html.Lookup("s.Site", null, Url, "Sites") %></td>
</tr>
<tr>
<td class="label">Data</td>
<td class="field date"><%= Html.TextBox("s.Date", DateTime.Today.ToString("yyyy-MM-dd")) %></td>
</tr>

I need to be able to get those parameters on the main aspx page, because they are needed for an action that is called there. How could I access these parameters?

View 1 Replies

Web Forms :: Share A Value Between Two User Controls (ascx) In A Aspx?

Jan 2, 2010

I wrote a one aspx page that include 4 ascx pages.

Among of them, two ascx pages are have to share a integer value.

A page can count a value, and I want it to be a part of other ascx page.

These pages have no button of link and neither user events.

View 4 Replies

Web Forms :: Handling Many Ascx Files On One Aspx Page?

Jan 13, 2010

I have one aspx page and more than ascx files, i have links on aspx page. if i click one of the link, it will upload the relevant ascx file on main aspx file.

View 1 Replies

Web Forms :: Access From Ascx Control To Public Variable From Aspx?

Jan 14, 2011

I have a variable in an aspx file I need to use/recover it's value into an ascx web control that's in this aspx file. It's possible to do it? The aspx dynamically loads web controls depending the scenario, so this web control not allways is loaded.

View 2 Replies

Get A Reference To The Current Class (ascx Or Aspx) Given A Member Object?

Mar 14, 2011

Given an instance of a control SomeControl that is in a some file (could be a usercontrol/ascx, or an aspx) how can I get a reference to the class to which it belongs?

In a usercontrol, SomeControl.NamingContainer seems to be reliable.

In a page that inherits from a MasterPage, this will return a reference to the ContentPlaceHolder, not the actual class that defines the aspx. What I would want in that case is SomeControl.Page

Parent will return the parent control in the heirarchy so isn't much use.

Is there any method for getting this directly regardless of what kind of thing it is?

View 2 Replies

Forms Data Controls :: Pass Value From Aspx To Ascx Textbox?

Oct 18, 2010

From an ascx page, I click a link that opens a popup aspx page(child). That aspx page has a gridview with hyperklinks. When I click on one of the hyperlinks of my gridview, I want to pass the value in that cell to a textbox located on my ascx page(parent). I try using javascript , but I can't get it to work. here is my javascript code and the gridview code:

<script language="javascript" type="text/javascript">
function post_value(str) {
window.opener.document.getElementById('textbox1').value = str;
self.close();
}
</script>

[Code]....!

View 2 Replies

Change Title Name Of Page.aspx Through Control Webcontrole.ascx

Jul 5, 2010

i want to change the title of my page.aspx through its control webcontrole.ascx

View 1 Replies

Make AJAX Redirects - Page_Load Methods In .aspx And In An .ascx ?

Jan 5, 2010

Ok, this is a bit different scenario. I guess I would have to think about doing it this way sort of with MVC anyway if we were actually using MVC...but we're not at the moment.So I've got and .aspx page. In that .aspx page is a user control (.ascx). And in that user control is a custom control (.cs).

The custom control has a repeater in it. So I'm showing a list of items on that .aspx through the .ascx's custom control. For each item in the repeater is a button. It's just a hyperlink, just a regular on my page When you click that button, it redirects to whatever page you're on. Since the custom control never knows what your parent .aspx page is, I'm doing a redirect to the self .aspx by doing a Response.Redirect(Request.Path). So that way it always redirects to whatever .aspx is using that user control and custom control.

So after it redirects to self, I check the querystring in the page_load of whatever .aspx is using it. If the value is true, then I handle it however the .aspx wants to. In this case when it's true, I call a method in the code behind of my .aspx that handles the action for the button. For example lets say that button was "Add to Shopping Cart", the .aspx handles that action and calls a AddToCart method in the .aspx.cs.

I'm not using an ASP.NET control for the actual hyperlink and button because I just don't need it and in my particular case I'm using a user control and a custom server control.For this instance, I had some issue where I didn't wnat to use an ASP.NET control...I forget why but the point is, no this is what it is.

So with that, I'm trying to figure out how I can apply some AJAX here call to call that method instead. I still need to somehow redirect again back to the same page like I'm doing...I'm doing the redirect in that method after all the logic at the end. I am redirecting again back to the same page, because I need my Page_Load methods in my .aspx and also in an .ascx to still fire off after that method is completed.So I am not sure where to start on this. Let me go through this once again:

Custom control has a repeater in it and in the repeater, each item has a standard HTML hyperlink (non ASP.NET control) which wraps a standard image tag (image is a button)User control contains the custom control The .aspx page contains the user control User clicks the butt on and hyperlink redirects them to the parent .aspx page that is using this custom control...so it callsResponse.Redirect(Request.Path)

In the code-behind of this .aspx, in my page_load I check a querystring flag to see if I performed that action..meaning user clicked that button. For example one of the querystring params is "AddItem" and another querystring param is "itemID". If movedItem is true, then I fire off a method called MoveItem(int itemID) Method MoveItem is called Method MoveItem redirects again back to this same .aspx using Response.Redirect(Request.Path).. this is so that the page load is hit again as well as my .ascx page load is hit. Because in both those page loads, I rebind a repeater so I can show the latest state of the lists. I call a method in my .aspx page_load which rebinds a grid and then page_load in my .ascx also calls another method which rebinds some other list

View 1 Replies

C# - Accessing Source Code Generated From ASPX/ASCX Files?

Mar 3, 2010

You've probably noticed that when you debug an error which comes from an ASPX or ASCX file (literally, not from a corresponding code-behind file), ASP.NET displays an error page showing you the source file and the line on which the error occurs. The source file being displayed is automatically generated from parsing the page/control. The question is: how can I see this source file without purposely causing an exception?

I'd love to hear that there is some programmatic way (the complexity doesn't matter) to generate source files (preferrably, .cs) from a series of ASPX/ASCX files.

Example. Consider the following ASPX page (the code-behind file may even be absent):

<%@ Page Language="C#"%>
<%@ Register Assembly="AspxGen" Namespace="AspxGen" TagPrefix="ag" %>
<html>
<head><title>Some Title</title></head>
<body>

[Code]....

d:DevAspxGenAspxGenDefault.aspx(9,80): error CS0103: The name 'ThereIsNoSuchProperty' does not exist in the current context

This means, theoretically I can open the .CS files passed to the compiler (namely, App_Web_sqj3krv3.0.cs and App_Web_sqj3krv3.1.cs) and see what ASP.NET has generated from my ASPX markup. Trying to rephrase the previous question: how can I obtain this file from an arbitrary ASPX file (assuming that the file is correct and hence no info will be given on where to search)?

View 3 Replies

User Controls :: How To Pass Value From UserControl (ASCX) To Page (ASPX)

Jan 19, 2014

I have two files in my project. One is user control (popup) customerpicker.ascx and one is default.aspx page. In customerpicker I have dynamically generated gridview and 'select' column with SelectButton.

What I want is this: When I click on 'select' on random row in gridview, then I like to display value from selected row immediately (like ajax) to aspx.page. How it is possible?

There is part of my code in .ascx:

public string showOnaspx { get; set; }
protected void GridView1_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
{
GridViewRow row = GridView1.Rows[e.NewSelectedIndex];
showOnaspx = row.Cells[1].Text;
e.Cancel = true;
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
GridViewRow row = GridView1.SelectedRow; 
//row[i].Attributes.Add("onclick", "$('#ContentIndex_sometextbox).val(" + row[i].Cells[1].Text// + "); $('#Close').click();");
}

I also tried with jqeury (comment in selectedindexchanged function), but it does not work well, because user have to click SELECT two times to effect.

View 1 Replies

Web Forms :: Converting Aspx To PDF?

Oct 3, 2010

[code]....

the above code only converts controls in dvtext (div) like label name and textboxname to pdf. after entering values into textboxes. it is not convert them to pdf. it only converts control names.

View 3 Replies

Converting .aspx Page To .pdf?

May 14, 2010

I am trying to convert my .aspx page to .pdf file ,here .aspx page contains htmltable and tr and td tags with span id and in span id innerhtml i am getting the data from database datarow and filling data in spanid ,

is there is a way to convert that page to .pdf in runtime when i click on hyperlinkl i cant use the third party apps because i cant bare that.

View 6 Replies

Web Forms :: How To Get User Controls(ascx) Fields In Normal Page (aspx)

May 19, 2010

how to get asp.net user controls(ascx) fields in normal asp.net page (aspx)

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved