I had a .Net 1.1 Webapplication which I have converted to the .Net 3.5 and published on the Windows Server 2012. There is a grid in a page where I need to delete a records with the cross button in the grid. But when I try to delete it shows the following error in the Chrome Console
GET
http://10.72.10.225/Models/SEIIAG/WebResource.axd?d=3IplHgLpPO4L8SEYBdyuKR9…fWWwa68LbCK6T7EgwTmR_WdnTJJbBQZJoJJGdKMX0cZCVl9eahgU1&t=635161970660000000
500 (Internal Server Error)
Uncaught ReferenceError: WebForm_DoPostBackWithOptions is not defined
Workaround 1:
In case the page where the problem is observed is based on .master page Sitefinity template.
Add the GetPostBackEventReference manually to the .master page in the OnPreRender event handler. In order to do that you will need to add a code-behind to the master page.
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
var control = this.Controls[0];
this.Page.ClientScript.GetPostBackEventReference(control, string.Empty);
}
Workaround 2:
In case the page or page template uses asp:LinkButton controls change them to asp:Button controls.
Taken from Here
Got the solution
Go to IIS
Select your Virtual Directory
Select Handler Mappings
Double Click on that
Select *.axd and click Edit button
Change the value of executable section to
C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll
Click Ok
Related
Im wondering how i can change "views" with a button click in Visual Studio (asp.net)?
I have 2 .aspx files, one called Default.aspx and another one called Library.aspx. How can i make a button change the views to display the other aspx file?
I tried googling but didnt find anything useful. Any help here is appreciated. Thanks
Ok, assuming default.aspx is in desing mode, then just drop a button from the toolbox onto the web page.
Say, like this:
Now, double click on the button, and we are jumped to code behind.
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("Library.aspx");
}
So, we put for the code to jump to the web page Library.aspx
We get this then:
And now, when I click on that button, I am jumped to the web page called Library.aspx - we should see this (assuming the web page Library.aspx exists).
I have a Visual Studio project in which I have created a Visual Webpart. In the user control I have a panel which I want to display in edit mode and hide in browse mode.
ASP.NET code snippet:
<asp:panel runat="server" ID="myControl">
C# code snippet in user control code behind:
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
WebPartManager wpm = WebPartManager.GetCurrentWebPartManager(this.Page);
if (wpm.DisplayMode == WebPartManager.BrowseDisplayMode)
{
myControl.Attributes.Add("style", "display: none");
}
else if (wpm.DisplayMode == WebPartManager.EditDisplayMode)
{
myControl.Attributes.Add("style", "display: block");
}
}
This works, but if I have two same webparts on same page and put one webpart is edit mode it shows the panel in both webparts. It seems the OnPreRender event code runs for both webparts on page.
I even tried writing code as this.myControl.Attributes.Add("style", "display: block"); but it still didn't work.
I want the OnPreRender code to run only on its webpart and not modify the other webaprt on page. How can I resolve this? Is there any better (or preferred) way to do it?
NOTE: I need to use display: none because the panel would be accessed via JavaScript.
PS: This is a cross post from here as I did not get any satisfactory answers.
I do the same on the page load, and it works for me just fine .. (page has about 10 WP and only 1 behaves differently in the edit mode.)
Maybe what you mean is that you have 2 SAME webparts on the page? Then I guess both webparts will behave equally because WebPartManager.DisplayMode returns you the mode of the page, not the webpart. (see msdn).
on Default.aspx I wrote this code it succesfully shows me Webform1.aspx but it has also one button when I click on that button it give me error
protected void Page_Load(object sender, EventArgs e)
{
var pageView = PageParser.GetCompiledPageInstance("~/WebForm1.aspx", Server.MapPath("~/WebForm1.aspx"), HttpContext.Current);
(pageView).ProcessRequest(HttpContext.Current);
}
Error on button click
Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
I think you should try these:
define the following parameter in your both page directives after # Page in your .aspx files.
EnableViewState="false
Then add this in your webcofig in the system.web tag:
and modify your pages tag if exists or add as follows:
I do think it will serve your purpose.
PS: I am using all above in my own project in which I am creating instances of many webusercontrols in side my application and it works fine!
I have a visual web part (a simple form) with RequiredFieldValidators. But a problem has occured since the field validators block editing of the page. When i press Edit Page in Sharepoint it starts to load then the validators fire and the javascript is stopped.
I found a solution but i cant get it to work.
Like this
public override void CreateChildControls()
{
if(SPContext.Current.FormContext.FormMode == SPControlMode.Edit)
((UserControl)_ctl).EnableValidators(false);
((UserControl)_ctl).EnableValidators(true);
}
//But the _ctl does not exit i only have
Control control = Page.LoadControl(_ascxPath);
A litte advice would help this sharepoint noob a great deal.
The form is just Labels, Inputs, a button, updatepanel and requiredFieldValidators
Can you not just set the ValidationGroup for the validators and button? Like this: http://msdn.microsoft.com/en-us/library/ms227424.aspx
The validators should only fire when the button is pressed.
There is something wrong with your configuration - I tested this configuration and the required field validators definitely don't block editing on the page. Do you want to post your page and your code behind? Might help to troubleshoot the problem.
i am using Intelligencia UrlRewriter for converting my page
www.mywebsite.com/subject.aspx?subject=sub1
to
www.mywebsite.com/subjects/sub1.aspx
On this page, I have next and previos buttons to browse the different subcategories on that subject and have used DataList with paging to support that.
When the page is first shown(IsPostBack=False) it works fine, but when next button is fired, the URL converts into this:
www.mywebsite.com/subjects/subject.aspx?subject=sub1
Is there any idea why it is happening ?
My web.Config file is as follows :
Mt web hosting company uses IIS 7.
EDIT: I have windows 7 and I tried by using local IIS and it ran fine there.
You can code this in your master page for this problem
Here form1 is the form tag and place it in master page's load event
protected void Page_Load(object sender, EventArgs e)
{
form1.Action = Request.RawUrl;
}