i'm having a WebPart for displaying information about employees and i want to display only a view information about the persons. The rest should be available after clicken on a "more" link. I tried to get that with opening a "popup"window.
But i don't get that to work right. So i tried using a new page. Hence i added a new aspx page to my project in visual studio
and added a link to that page like that:
LinkButton link = new LinkButton(); link.Width = Unit.Pixel(20);
link.Text = "more";
After building the project i tested it in my webpart page and get an error
"An unexpected error occured".
It took me a lot to get the webpart work properly again.
Has anybody an idea what i'm doing wrong. (i also tried to catch an exception without success)
I also tried to add an click event to that "more" link. but then, when i hover above that link with the mouse i see
"javascript:__doPostBack('ctl00$m$g_84d91faf_d0a8_4587_bb7c_712030d2c4ea$ctl00$ctl18','')"
i tried with link.OnClientClick and link.OnClick, nothing works.
I really need that function for that page.
I would highly appreciate it if you can give me a code snippet of a solution.
Thanks in advance
You should use PostBackUrl property of linkbutton Or on button click event you can call Response.Redirect
Related
I've created a custom webpart to register a new user. I added a button to register and on-click event register I write my code . when I add the web part to kentico it gives my error loading the webpart ,when I remove the on-click event it works fine . How I could solve this and I need to write the code inside the event. thanks
Have you followed the Creating new webparts example in the Kentico documentation? Make sure that your user control inherits from one of the base classes listed there.
It might also help if you paste the error from the Kentico event log, as this may give more of a clue as to what is not working.
I have a report that specifies a 'Go to URL' action for a textbox. The URL I am using is simply a field from the dataset, so the expression for the URL is something like "=Fields!URLLinkText.Value". When I deploy the report to SSRS Report Manager, the link works fine. It is clickable and opens the URL. However, when I link to the report from the custom asp.Net Reporting Application, the link is not clickable. The cursor of the mouse does not even change when I hover over the link. It seems like the hyperlink/Go To property of the textbox is completely removed. At first, I thought that this had to be an issue with the configuration of the reporting app, which was disabling external hyperlinks. However, I created another report with just one textbox with a Go To Action to go to www.CNN.com and it worked on both the Report Manager and the Report Application...
Any suggestions?
I was just posting about a possibly related issue. It does not involve any custom reporting app though. http://weblogs.asp.net/mnissen/archive/2009/03/26/reporting-services-does-not-display-hyperlink-for-placeholder-with-go-to-url-action.aspx
A few different options you can try: wrap the link in javascript, try "servername:port" instead of the site name if its internal, or try reversing the slashes like http backslash backslash...
You will need to handle the Hyperlink clicked event for your reportviewer control:
Assign the handler in your reportviewer constructor
YourReportViewerControl.Hyperlink += new HyperlinkEventHandler(YourReportViewerControl_Hyperlink);
void YourReportViewerControl_Hyperlink(object sender, HyperlinkEventArgs e)
{
e.Cancel = true;
System.Diagnostics.Process.Start(e.Hyperlink);
}
In my Asp.net application am trying to display files from the hyperlink, the hyperlink is inside of GridView and my script is
View Attachment
the value for this Url is like , localhost:1010/Attachments/test.jpg
when I click this link, it displays the image in a new window, no problem.
But my application page displays only the "[object]",nothing there except this.
am facing this problem only with IE, in chrome its showing perfectly...
how can I fix this, can anyone help me here...
I've found in IE9 that by setting the return reference from window.open to a variable, the behavior you describe will be prevented from occuring.
View Attachment
I am using C# ASP.net, and relative new to it, and need to accomplish below.
In my VS2010 web application project I have default.aspx, form1.aspx with button1 and form2.aspx.
1-I want to set form1 as my home page (the first page that opens when I run app)
2-Want to open form2 when I click button on form1
Also, can you please suggest good book that covers items like above?
thanks
Jay
Quick start would be to double click the "button1" in designer view, which will generate a button1_click(...) event handler. In this routine, you could write one line of code:
Response.Redirect("~/form2.aspx");
To set Form1.aspx to your "homepage", it would make sense to rename it to "default.aspx" which is usally the page IIS looks for to start from.
hope it helps,
When publishing, in the IIS you have to make the default page the form1.aspx page. In your VS2010 just right click on the file and set it as start page.
Yes, the Response.Redirect answer posted is correct.
I've found that ASP.NET Unleashed is really helpful for beginners. You can find it on amazon:
http://www.amazon.com/ASP-NET-4-Unleashed-Stephen-Walther/dp/0672331128
i have two controls on asp.net page , textbox and button and i want to write new page into textbox then when i hit the button i want to create new asp.net web page with textbox text. what do you want me to prefer to do this? is there any step by step tutorial or any code you have done before? thanks for asnwers.
ok more detail about what i want.
textbox control text is "contact" and i click my button control. button take textbox text "contact" and create new web form page which name is "contact.aspx and its code page contact.cs" . thats it. just create new web form page under root directory with button click.
maybe there is a single code line like
Page pg =new Page();
pg.create();
You can use File.WriteAllText to write the contents of the textbox to any location that the application pool user has permissions to write to.
From your edit it appears that you are looking for a CMS/wiki kind of functionality. There is nothing like that built into the .NET framework.
I suggest you look for wiki software.
No need to worry about big codes etc
You can create it with 2 simple steps explained in my blog
Create one empty page then copy it using Files concept. Save it as what ever name you want.
Try to change the content inside newly created page to Run smoothly
Please visit my blog for example solution
Click here for Solution Post
You can use the Page.ParseControl method.
Beware, it does not support everything you can do with a real ASPX or ASHX file, but it works for simple things. An example is available here: Using Page.ParseControl to add new control from Control Tag
There is very simple way to do that. It is working on principe to Copy one your Page, you should put Page with controls that you want to use on your other pages. So first you need using System.IO; then you need this code
protected void Button1_Click(object sender, EventArgs e)
{
try
{
File.Copy(Server.MapPath("") + "\\Submit.aspx", (Server.MapPath("") + "\\" + TextBox1.Text + ".aspx"));
File.Copy(Server.MapPath("") + "\\Submit.aspx.cs", (Server.MapPath("")+ "\\" + TextBox1.Text + ".aspx.cs"));
Response.Redirect(TextBox1.Text + ".aspx");
}
catch
{
Response.Write("<script>window.alert('This page is taken. Please change name!')</script>");
}
}
As you can see, The page you are coping is called Submit, and new Name of your Page is called like textbox1.text.
I hope that this helped you and anyone else.
enter link description here
Before some time I saw a logical question in a web site in this a person give the problem as like this
“I have one page called First.aspx in my web application, in this page; I have a simple asp.net button control. And I want is, on the click event of that button control, create (render) a new dynamic "page" that can be opened in a new windows or tab”
.
Here we give An Example here to creating a new .aspx page at run time. We also give the option to give page name. The user can give as he/she like. Like Google blogging we make new page at runtime.The new page is not in the website, this page create needs to be created at runtime and needs to be dynamic.