|
Response.redirect is for posting data from a form and then performing server-side processing, in which the server does a bunch a work, and then determines the outcome based on the results, in which a Response,Redirect can be issued.
If you want to just change pages, you use a hyperlink, or hyperlink button.
Using response.redirect to just change pages is a waste of resources.
Changing pages based off the event (textchanged) is a bad idea, because it fires the event on every key-up, unless you test the magic word 1 char at a time until complete, and then fire off a page change.
|
|
|
|
|
In an existing application, I am changing the following logic:
When the user enters a specific transaction code in a textbox field, a textbox is displayed by setting the visible property of another textbox field to true. What I need to do is to replace the textbox field that is displayed with a link to another page. The link to the other page will allow the user to enter up to 8000 characters in a comment field. Once the user enters the information, they will hit the save button and they will return to the page they started on.
Thus can you tell me how to code for this situation?
|
|
|
|
|
So you enter a code in the textbox. If the code matches, then you can type away in a textarea, when done, the text is saved and you return back to the textbox you enter the code in.
If correct, why not just make it on 1 page.
|
|
|
|
|
I want to mention the following:
1. The page where you enter the data is too small. There is not enough room on the webpage to enter the data. The user wants to be able to enter 8,000 to 20,000 bytes of data if they need to. They want to be able to adjust the new texabox area the way they want to. The user wants to be able to type the data in paragraph format. The user requirement is to have that one textbox on one webpage for their convenience. This is a requirement that can not be changed.
2. I also wanted to mention the following is the code I have to work with right now:
TextBoxCode.TextChanged += new EventHandler(TextBoxCode_TextChanged);
void TextBoxcode_TextChanged(object sender, EventArgs e)
{
if (TextBoxCode.Text == "")
{
ButtonPending.Visible = true;
}
else
{
ButtonPending.Visible = false;
if (TextBoxCode.Text == "999")
{
Response.Redirect("~/Reason.aspx");
}
}
Can you make suggestions how to accomplish this goal, by hopefully using a hyperlink?
|
|
|
|
|
You issued a postback to the server, so response.redirect is appropiate
If you would of went
.onClientClick = "return process_textbox; return false;";
And then write your fucntion - requires jquery
function process_textbox() {
var txtValue = $('[id*="_txtBox"]').val();
var txtValue_Len = $('[id*="_txtBox"]').val().length;
if (txtValueLen > 0) {
var newUrl = "newPage.aspx?id=" + escape(txtValue)";
window.location.replace(newUrl);
}
}
|
|
|
|
|
Thank you for your response!
I have the following questions about the code above:
1. Would the code above need to have a script tag before and after it like javascript required?
2. I am assuming the newUrl is the location of the web page?
3. I am assuming the txtValue is where I can use the specific code the user is required to enter,correct?
4. Is the placement of a jquery request need to be anywhere specfic in the *.aspx page? This would be like javascript tag is usually in the header tag of an html page?
|
|
|
|
|
1. Yes
2. Yes - Place the JQuery Script tag in the header to load it first, then create a separate file, and place the script tags at the bottom of the page. I think it has to be inside the body, but at the bottom to keep it clean
3. I just made that up, I figured the txtValue was important, so you would want to pass it as a querystring value
4. Load the Jquery in the head tag, after your css, and load your function file at the bottom of your page, within the body tag.
If your using master pages, that's ok, just use unique names for your js files such as
jquery.js
jquery.comment.sel.js
jquery.comment.form.js
If your using an update panel, you will need to load the jquery after each async postback the panel creates
$(document).ready(function () {
initializeBinding();
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
});
function EndRequestHandler(sender, args) {
initializeBinding();
}
function initializeBinding() {
$(document).ajaxStart(function () {
});
$(document).ajaxStop(function () {
});
$('[id*="_txt_ProductEditor_Basic_PartNumber"]').blur(function () {
check_PartNumber();
return false;
});
}
function check_PartNumber() {
m_ProductID_Length = $('[id*="_txt_ProductID"]').val().length;
}
|
|
|
|
|
Hi All,
I have a wcf service and its client, a component WCF service is using the following office dlls in generating the word to pdf and excel to pdf files. On my machine everything is working fine, but when I hosted the application on the server, its failing in accessing those dlls. I found that server doesnt have the ms office installed on it. My question is, is there any free way that I can accesss those dlls without installing the office on the server. Actually WCF service is referencing another project on my machine which is referencing those dlls. Means indirectly WCF is referencing those dlls. Is that also a problems. Please help me. If its complesoury to have the office installed on the machine, please advise me which version of office is must to have on the server to make all this working. And when I enabled logging in my WCF service it was throwing exception as
"Microsoft.Office.Interop.Word, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c
"Following are the dlls: Microsoft.Office.Core, Microsoft.Office.Interop.Excel, Microsoft.Office.Interop.Word, Microsoft.Office.Tools.Excel.v9.0, Microsoft.Office.Tools.v9.0, Microsoft.VisualStudion.Tools.Applications.Runtim.v9.0
Please help me I am in desperate need. I want to run all my application without office is there any way to do that.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
modified 8-Aug-12 16:39pm.
|
|
|
|
|
indian143 wrote: is there any free way that I can accesss those dlls
No and Microsoft does not support this type of configuration.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
In a C# web form 2010 application, I am trying to get an existing web page to point the user to a new page page. The user enters a value into a textbox field and c_textchanged(object sender, EventArgs e) is occurs (is called). When the user is in this routine, I want the application to go to my new web page. However, I am getting the generic error message that occurs is the web site default.
I am trying to do the following command,
command:either Page.Response.Redirect("Reason.aspx"); or Response.Redirect("~/Reason.aspx");
Thus can you tell me the following:
1. Where in the visual studio.net ide, would I find the real error message? Is there a log file to look at? Where would I find the log file?
2. I am guessing the code can not find the new page. Could there being something wrong with the new page page? This is the only place I am using the partial class called reason. is that a problem?
The new web page looks like the following:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Sup.Pages.Proc
{
public partial class Reason : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
}
}
}
|
|
|
|
|
Might have been a good idea to show the exception as well as the code that produced it. Have you wrapped the code in a try..catch and stepped through to see what is going on?
Something like:
try
{
Response.Redirect("~/Somepage.aspx");
}
catch (Exception exc)
{
Console.WriteLine(exc.StackTrace);
}
Note: you can use NLog or Log4Net to log all of your errors to the event log, a text file, etc., instead of the somewhat crude Console.WriteLine (as example)
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
Aoa friendz,i am a beginner in Asp.net.i have been given a task that is how to extrack an image from an email and save it on a disk in asp.net web based or in in c# desktop based.Can anybody help me out.??
|
|
|
|
|
Take a look at the classes in System.Net.Mail which should provide you with some access to parts of an email message.
I believe you want to look at Attachments. (maybe)
Good luck.
|
|
|
|
|
Unable to Maintain griedview scroll position in to the Internet Explorer Print Preview Window.
Inner html area of the page display properly in to the print preview dialog box. But if there is a scroll in the page and user scroll it, then print preview does not reflect the scroll area of the page.
We have taken inner html of the display area and using ExecWB(7, 2) to bring up the print preview dialog box. When we pass the inner html through the “Window.open” object and call the ExecWB() function then it cannot maintain the div scroll position.
below is our print function:
function printFile() {
var InnerhtmlString = $("#MainBody").html();
var innerDiv = $("<div>");
innerDiv.append(InnerhtmlString);
innerDiv.remove("script");
var html = "<html>";
html += "<head>";
html += "<style type=\"text/css\"> @import url(\"./../CSS/styles.css\"); </style>";
html += "</head><body>";
html += innerDiv.html();
html += "</body></html>";
var printPreviewObject = '<object id="printPreviewElement" width="0" height="0" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>';
//var printWin = window.open('', '', 'left=100,top=100,width=1,height=1,toolbar=0,scrollbars=0,status =0');
var printWin = window.open('', 'Print', 'left=100,top=2000,width=700,height=600');
printWin.document.write(html);
printWin.document.write(printPreviewObject);
printWin.document.write('<script language=JavaScript>');
printWin.document.write('printPreviewElement.ExecWB(7, 2);');
printWin.document.write('printPreviewElement.outerHTML = "";this.window.close();');
printWin.document.write('<' + '/' + 'script' + '>');
printWin.document.close();
printWin.focus();
// printWin.print();
// printWin.close();
}
Please Help.
Thanks and regards,
Debasish Chowdhury
modified 9-Aug-12 5:50am.
|
|
|
|
|
How to bind datatable retrived from databse...to radtree view or radtreelist...
datatable has fields one Project name has many Maintasks and one maintask has many Subtasks.
|
|
|
|
|
|
Hello Guys,
My question is simple i want create a website where the user can select the type of language. Please ref the link http://24x7onlineshopping.co.in/default.aspx
i want to achieve this kind of selection. On selecting the language evey thing just changes the language type. I tried googling & found Resource files can be made for each language & found it lengthy but is it possible to acheive globalization using a access database, want i meant is "when the user changes the type of language the culture type should change corresponding to which the whole site's language" Please help me create a website with multi language using database. i hope my point is being delivered. Thanks in anticipation.
Regards,
delhiegle
|
|
|
|
|
|
ya i did look at those articles but they all are using resource files, but i want to use database & culture codes. When the user selects a language, culture code of that will be selected corresponding to which the text from the database should change on the pages.Is this thing acheivable.
|
|
|
|
|
SO you want to take a well known, tested and robust built in mechanism, and reinvent it cos you don't like it....yeah...good luck with that one...
C# has already designed away most of the tedium of C++.
|
|
|
|
|
Hi All,
I have an asp.net application which is consuming a WCF Service which is using WSHttpBinding, but when I try to call the operation contract of the WCF service I am getting following error.
Can anybody please help me reagrding this. Following is the error description.
Secure channel cannot be opened because security negotiation with the remote endpoint has failed. This may be due to absent or incorrectly specified EndpointIdentity in the EndpointAddress used to create the channel. Please verify the EndpointIdentity specified or implied by the EndpointAddress correctly identifies the remote endpoint.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
Check your endpoint. Make sure you are pointing to the appropriate server.
|
|
|
|
|
|
Hello,
in my ASP .NET page I have created check box double clicked it, it then created,
chbCalcPrim_CheckedChanged
method but it never fires. I am changing the state of it i.e. in checked or unchecked but that method is never executed.
What is the problem, should I use any script?
|
|
|
|
|
Is AutoPostBack set to true?
Schenectady? What am I doing in Schenectady?
|
|
|
|