Acessof Undefined Property Event And Resolve It?
Feb 10, 2010public function assgn()
{
var recA:Sprite = new Sprite();
[code]...
public function assgn()
{
var recA:Sprite = new Sprite();
[code]...
I am using RadAsyncUpload which is defined like this
Code:
<telerik:RadAsyncUpload ID="FileUpload1" runat="server" Skin="Forest" Width="272px">
</telerik:RadAsyncUpload>
And I have a asp.net button defined like this
Code:
<asp:Button ID="btnUpload" Width="180px" Height="30px" runat="server" Text="Upload"
onclick="btnUpload_Click" />
Now it works and it uploads the file , but now i want to have a Progress Bar , so like other controls i did the following
Code:
<telerik:AjaxSetting AjaxControlID="btnUpload">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="btnUpload" LoadingPanelID="RadAjaxLoadingPanel1"></telerik:AjaxUpdatedControl>
[Code] ....
If I add this Ajax code , my Upload does not work , it give me the Following Error
Code:
Uncaught TypeError: Cannot read property 'id' of undefined
And chrome gives more info like
Code:
Uncaught TypeError: Cannot read property 'id' of undefined Telerik.Web.UI.WebResource.axd:2889
Telerik.Web.UI.RadAjaxControl._initializeRequest Telerik.Web.UI.WebResource.axd:2889
H.z.callBaseMethod Telerik.Web.UI.WebResource.axd:3
[Code] .....
I'm using javascript to change some settings of asp button on mouseover. It is working in IE. But not working in Firefox. Is there any other javascript code that will support almost all browsers? My code is as follows
<script type="text/javascript">
var previousColor;
function Changecolor() {
previousColor = window.event.srcElement.style.backgroundColor;
window.event.srcElement.style.backgroundColor = "Blue";
window.event.srcElement.style.cursor = "hand";
}
function RestoreColor() {
window.event.srcElement.style.backgroundColor = previousColor;
}
</script>
<asp:Button ID="btnSearch" runat="server" BackColor="#800000" Font-Bold="True" Font-Names="Arial" onmouseover="Changecolor();" onmouseout="RestoreColor();" ForeColor="White" Height="28px" OnClick="btnSearch_Click2" Text="Search Jobz" Width="117px" />
I have a GridView with the following event:
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
foreach (TableCell c in e.Row.Cells)
{
c.Attributes.Add("full","false");
}
}
And in my javascript I have an onClick event for every cell:
if(source.full="false")
{
...
source.full="true";
}
else
{
...
source.full="false";
}
Why is it that source.full is always undefined on the first click?
Can we write property in property?IN the page load event we have page property and we can find another page property in that page property.Pls let me know how this is happening
View 5 RepliesWe have a site running FW 2.0 on IIS 6. Actually two sites (on the same server), one works and one has that little Done with errors note in the lower left. The errors are 'Sys' is undefined & WebForm_SaveScrollPositionSubmit' is undefined. I have cleaned the bad site, copied the code from the good site, including web.config, and still see the problem. This was working for a number of months, then I guess we didsomething, and now the errors.
View 2 RepliesFrom:
[URL]
The OriginalSource property of the object identifies the original object that received/initiated the event. Consider a custom control (called CustomControl1 in this example) that is composed of a TextBlock. When a MouseDown event is raised on the TextBlock, the OriginalSource property will be the TextBlock, but in CustomControl1's handler, the Source will be changed to the CustomControl1 object so that other elements along the event's route will know that CustomControl1 received a MouseDown.
Is there equivalent of WPF OriginalSource event property in Winform and ASP.NET ? If not how to emulate this ?
I created a control where other developers can create an instance and use. There is a button click in the control. How do I allow developers to plug in their own code in a certain part of my control? I am not sure if or how exactly to use a delegate or event in this scenario.
[code].....
How to I update MyControl to allow this?
I have a web form with two RadioButtons, both use the same GroupName, both have AutoPostback enabled and both have an event handler for CheckChanged. I use tem to show/hide a Panel further down the form which is contained in an UpdatePanel with Conditional Update set and with both CheckedChanged events in the Triggers collection:
[Code]....
Now, the problem arises when I set the Checked property of either RadioButton in Page_Load, which results in the even not firing for the button which was marked as Checked (the event for the radio button whose property was not assigned does get fired). In fact, upon inspecting the source there was no 'onclick' attribute declared for the input element that was marked as checked in the Page_Load, whereas the other RadioButton did have the 'onclick' attribute properly set.
The layout of the form doesn't allow me to place the radio buttons within the UpdatePanel, so that is out of the question. Is the behavior explained above normal? am I missing anything? Both events fire once the assignment to the Checked property is removed from Page_Load.
I wanted to get the total row count in a GridView's databound event handler, so I tried the following:
protected void grid_DataBound(object sender, EventArgs e)
{
GridView grid = (GridView)sender;
DataSet data = grid.DataSource as DataSet;
if (data == null)
return;
int totalRows = data.Tables[0].Rows.Count;
}
The problem is that the grid.DataSource property is null. The DataSourceID property is not null, so does that mean that I can't access the DataSource object in the DataBound event handler unless I assign the DataSource property directly?
Edit1: Here is the code in my GridHelper class for adding rowcount to the BottomPagerRow. I would like to get rid of the requirement to pass in the ObjectDataSource, but can't because I need to use the Selected event to get total row count. Hence the reason for the question. I also think this might be better in a custom control where I can access ViewState, and/or create child controls during the Init event (I still have a problem to resolve with the way the pager renders with an extra cell), but then I'd still have the problem of how to get to the total row count when the DataSource itself doesn't appear to be available in any GridView events.
Edit 2: Not really relevant to the specific problem, but I resolved the problem I was having with the pager rendering so i've updated the code posted. I found the trick here: [URL]
#region Fields
private int totalRows = -1;
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="GridHelper"/> class.
/// Adds EventHandlers to the GridView to display results from the ObjectDataSource in the footer.
/// Marked as obsolete because AddResultsToFooter method provides a static access to the same functionality
/// An instance of GridHelper is required by the passed in GridView to store the totalRows value between the two event handlers
/// </summary>
/// <param name="grid">The grid.</param>
/// <param name="source">The ObjectDataSource linked to the GridView.</param>
[Obsolete("Use AddResultsToFooter instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public GridHelper(GridView grid, ObjectDataSource source)
{
source.Selected += source_Selected;
grid.PreRender += grid_PreRender;
}
#endregion
#region Event Handlers
private void grid_PreRender(object sender, EventArgs e)
{
GridView grid = (GridView)sender;
if (grid.HeaderRow != null)
grid.HeaderRow.TableSection = TableRowSection.TableHeader;
//Add a cell to the bottom pager row to display the total results
if (grid.BottomPagerRow == null || !grid.BottomPagerRow.Visible)
return;
//Get the control used to render the pager
//http://michaelmerrell.com/2010/01/dynamically-modifying-the-asp-net-gridview-paging-control/
Table tblPager = grid.BottomPagerRow.Cells[0].Controls[0] as Table;
if (tblPager == null)
return;
if (totalRows < 0)
{
//The DataSource has not been refreshed so get totalRows from round trip to client
addResultsToPagerTable(tblPager, grid.Attributes["results"]);
return;
}
int firstRow = grid.PageIndex * grid.PageSize + 1;
int lastRow = firstRow + grid.Rows.Count - 1;
string results;
if (totalRows <= grid.PageSize)
results = string.Format("<span class='grid-pager'>{0} Results</span>", totalRows);
else
results = string.Format("Results <b>{0}</b> to <b>{1}</b> of <b>{2}</b>", firstRow, lastRow, totalRows);
addResultsToPagerTable(tblPager, results);
//Need to store the information somewhere that is persisted via ViewState, and we don't have access to ViewState here
grid.Attributes.Add("results", results);
}
/// <summary>
/// Handles the Selected event of the source control. Gets the total rows, since it is not possible to access them from the GridView.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs"/> instance containing the event data.</param>
private void source_Selected(object sender, ObjectDataSourceStatusEventArgs e)
{
if (e.ReturnValue is DataView)
totalRows = ((DataView)e.ReturnValue).Count;
else if (e.ReturnValue is EntitySet)
totalRows = ((EntitySet)e.ReturnValue).Count;
}
#endregion
#region Private Methods
private static void addResultsToPagerTable(Table tblPager, string results)
{
//http://michaelmerrell.com/2010/01/dynamically-modifying-the-asp-net-gridview-paging-control/
//Get a handle to the original pager row
TableRow pagesTableRow = tblPager.Rows[0];
//Add enough cells to make the pager row bigger than the label we're adding
while (pagesTableRow.Cells.Count < 10)
pagesTableRow.Cells.Add(new TableCell { BorderStyle = BorderStyle.None });
//Add a new cell in a new row to the table
TableRow newTableRow = new TableRow();
newTableRow.Cells.AddAt(0, new TableCell
{
Text = results,
BorderStyle = BorderStyle.None,
ColumnSpan = pagesTableRow.Cells.Count
});
tblPager.Rows.AddAt(0, newTableRow);
}
#endregion
#region Public Methods
/// <summary>
/// Adds EventHandlers to the GridView to display results from the ObjectDataSource in the footer.
/// </summary>
/// <param name="grid">The GridView.</param>
/// <param name="source">The ObjectDataSource linked to the GridView.</param>
public static void AddResultsToFooter(GridView grid, ObjectDataSource source)
{
if (grid == null)
throw new ArgumentNullException("grid", "grid is null.");
if (source == null)
throw new ArgumentNullException("source", "source is null.");
new GridHelper(grid, source);
}
#endregion
i want to show a menu in some pages.
the menu is build from db with repeater
[code]....
when i am in "folder/page1.aspx" all the link are ok [URL]. when i'm in a folder "folder/folder2/page1.aspx" the links are [URL]
UPDATED:
i change it to
<a href="<%# VirtualPathUtility.ToAbsolute("~/admin/"+(string)Eval("TD_PageName"))%>"><%# Eval("TD_Name")%></a>
In my web application I am using NHibernate.dll. This has a dependency on folowing assembly.
'Antlr3.Runtime, Version=3.1.0.39271,
Culture=neutral,
PublicKeyToken=3a9cab8f8d22bfb7'
Now in the same project for another requirement I have to introduce Antlr3.StringTemplate.dll. Which has a dependency on another version of the above assembly.
If I use the version of Antlr3.Runtime.dll which satisfies NHibernate , Antlr3.StringTemplate starts complaining and vice-versa.
i have some textboxes in my parent page and a search button. when the search button is clicked, my modalpopup pops up. after chosing (clicking on the select button of the row) an entry from a gridview within my modalpopup (each row in the gridview has a buttonField), the rowCommand_Event fires... within this event i try to set the .Text property of some textboxes within the page containing my modalpopupExtender... i get no exceptions, but the textboxes are not set...
ModalPopupExtender:
[Code]....
ModalPopupPanel:
[Code]....
RowCommandEvent:
[Code]....
I have a facade class that my controller class calls out to and in that facade class, for whatever reason, I'm building a string a href element. And it resolves fine in casini but when it gets out in the real world like localhost it doesn't work. Is there a way to do this?
string goBackLinkForErrorMessage = "<br /><a href='/MyController/Action?id=" + blah + "'>Go Back</a>";
I am currently localizing my MVC website, using the Html.Encode method.
I've got a global resouce named "Localization" and using it by e.g. <%= Html.Encode(Resources.Localization.FirstName) %>
When compiled and viewing in the browser it works perfectly, but in VS 2008 Development Edition it marks it red and displays Cannot resolve symbol 'Resources' when hovering it.
I am writing a dynamic control that I want to pass in something along the lines of the following:
HyperLink myLink = new HyperLink();
myLink.NavigateUrl = "/Home.aspx?id=<%= DataBinder.Eval("PageId") %>";
myLink.Text = "The link";
myControl.Controls.Add(myLink);
I want to be able to resolve the myLink.NavigateUrl at run-time according to the context that myControl puts the control into in the end (this is not a WebControl and therefore adding to the collection of controls doesn't output to page).
I m receiving the following error when adding toolkitscriptmanager to my asp.net, thus i have installed all the needed dll's and if i create a new solution and use them it will work perfectly but if i add them to an exsting project it is giving me this errormoreover if i will run the application it will run without errors but the problem is if i add any new asp control likt textbox will not be available in the code behind but wheni remove the toolkitscriptmanager it works fine VS 2008 if any one know what is the solution
View 3 RepliesI am running an aspx page and keep getting this following error
[code]...
I am having issues trying to resolve this as the aspx page only has 129 lines and the vb page behind only has 28 lines. Can any point me in the right direction to track this error down
I have an ASP.NET MVC web application running in IIS as a subweb; let's say its path is something like http://mysite.com/subweb.
I have a view which serves content obtained from a CMS. The CMS editor has entered some content containing a relative image path <img src="/images/imga.png" />.
This works fine on the production server where the site is the root website, but not on the staging server where the site is a virtual directory under the root website
The path should be <img src="/images/imga.png" /> on the production server
and <img src="/subweb/images/imga.png" /> on the staging server.
Is it possible to use the <base> tag to resolve this image path?
<head>
<base href="http://mysite.com/subweb/" />
</head>
<html>
<body>
<img src="/images/imga.png" />
</body>
</html>
It doesn't seem to work. Can anyone explain why or if this is a workable approach? I don't want to require the content editor to have knowledge of the website deployment option (which changes between UAT and production).
i have deployed my website in windows 2003 server. my cliets are working on that.every day night i restart the machine untill that there is no problem. if i have not restart the machine then soon my clients recive "PAGE CANNOT BE DISPLAYED". if i restart the machine then the issue is solved. i want to know the issue which makes the site "page cannot be displayed" and i want to resolve the issue with out restarting.
View 4 RepliesUsing VS2008 and R# 5 I'm running into an odd situation, where on an aspx page I keep getting
Cannot resolve symbol 'symbolname'
But the code compiles and runs fine. While having a fix for this would be great, I'm just trying to figure out if I'm losing my mind.
The CodeFile directive and Inherits directives are fine. If I compile the app or just let devenv sit for a bit it'll go away, but as soon as I save the aspx [via ctrl+s] R# suddenly has trouble with the Inherits attribute and flips out on every method in the page (OnClick etc).
// Anonymized of course but otherwise intact
<%@ Page AutoEventWireup="true" CodeFile="TestPage.aspx.cs" Inherits="TestPage" Language="C#" MasterPageFile="~/MasterPage.master" Title="Test Page Title" %>
This is mostly just a grievance, because since the code compiles it doesn't stop me from doing what I need.
I would post a bug report to the JetBrains site but first I would like to know I'm not alone. It could be my machine. Maybe when I roll to VS2010 in a couple weeks this will go away?
I just installed SP1 for VS2010, and since then I get error messages from Resharper for stuff that used to work and be ok for Resharper (5.1) before.
The error messages are "Cannot resolve symbol 'Eval'" and some other methods other than Eval.
How do I solve this?
Is there a fix?
Is there some resharper cache that I must delete/clear?
(The code compiles and runs as usual)
This is a head-scratcher. I've got two projects open. In one of them I have no trouble incorporating DesignTimeResourceProviderFactory but in the second project I get the above error. Adding using System.Web.UI.Design does no good; "Design" is red and the rest is grayed out. No problem importing System.Web.UI though.
View 1 RepliesI was working with the previous version of the AjaxControlToolkit (I had the source project in my solution, just in case I needed to debug something) and everything worked ok, now I've downloaded the lastest build (40412) and I've choosen to remove that project and only use the binaries (of 40412). I added this line in the web.config (inside <controls>) to have it prepared for all the pages, and avoid the need to use the @register in each one of them <add namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" tagPrefix="ajaxtoolkit"/>
Now, only have the binaries I think I should used
<add tagPrefix="ajaxToolkit" namespace="AjaxControlToolkit" assembly="AjaxControlToolkit, Version=3.5.40412.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
and inside <assemblies> this line
<add assembly="AjaxControlToolkit, Version=3.5.40412.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e"/>
I don't know what should I write as PublicKeyToken, I'm getting Cannot resolve symbol 'AjaxControlToolkit' and, of course, my UserControls that use the AjaxControlToolkit are giving me error.
I am using ajax rating control, but i get the following error on change of rating , the funnest part is i get this error for every alternate submission, 1st time i click on rating stars it happen without error but 2nd time i do the same then error throws, for 3rd time no error , for 4th time again error and it continues "An unhandled exception has occured:
The target 'ctl00$ContentPlaceHolder1$dList$ctl00$Rating1' for the callback could not be found or did not implement ICallbackEventHandler." hope i get an ans for this funny kind of issue.