How can I remove the Request.QueryString without doing a Response.Redirect() User click's on a link like: http://localhost/__login.aspx?run=st
Now when the page is returned to the user I only whant the paht http://localhost/__login.aspx
to show. How can I do this without using a Response.Redirect("http://localhost/\_\_login.aspx")
thomasa
Posts
-
How to remove Request.QueryString from an URL paht in IE -
Is it possible to kill all events for a control?I have a page with a bunch og events for buttons and textchanged. At page load I want to validate an object I have added to Chash, an if it fails I want to kill the event that the user has triggerd, something like
protected void Page_Load(object sender, EventArgs e)
{
if (MyChachItem == null)
{
// Kill the event so it is not triggerd
MyAntemPlaceHolder.Visible = true;
ShowMessage(MyAntemPlaceHolder, "Can not continue, please click on the list button and start over.")
}
}So the user clicks a button (btnSave) on the page, that triggers the btnSave_Click(..) event. Thus, by the time the MyChachItem is null, as validate at Page_Load, and within that if() I want to kill the btnSave_Click(..) event, so it isn't triggerd. I think it's possible to use somthing like:
btnSave.Click -= btnSave_Click(..)
But my problem is that the MyHugeWebControl.ascx contains a lot of controlers with different events, and I was wondering if there where something I could do to kill all the events within that control. Thanks Thomas
-
special character in web linkHow can I make the Response.Redirect() method or something inside that methode not change the special character in the link. here is my code:
string strURL = "http://www.myweb.com/doThatThing.aspx?run=th&rp=Y”Ê" Response.Redirect(strURL, false);
Unfortunately it somhow changes the special characters so it ends up likhttp://www.myweb.com/doThatThing.aspx?run=th&rp=Y”Ê€
so the last part is changed from Y”Ê to Y%e2%80%9d%02%c3%8a%e2%82%ac I'm not exacty shore where the text is change. Any sugesstion? Maby I can change the parameter back from Y%e2%80%9d%02%c3%8a%e2%82%ac to Y”Ê ? Thanks Thomas
-
FontInfo to FontSomeone know how to convert a System.Web.UI.WebControls.FontInfo to System.Drawing.Font? Thanks Thomas
-
regsvcs on VistaIt has to be registerd under the 64bit framework as in
C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727>regsvcs "D:\Development\MyProdjekt\Main\bin\My.BusinessLogicObjects.dll"
That was freeking many hours wasted!!!
-
regsvcs on VistaI've registerd my dll in com by using the regserv from .Net framework 2.0 as in
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>regsvcs "D:\Development\MyProdjekt\Main\bin\My.BusinessLogicObjects.dll"
It seems to be registerd ok, as it does on my xp machine. But i still get: COMExeption occurred: Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG) Is there something I am missing, my new machine uses Vista Ultimate 64bit Thanks Thomas
-
HttpException The file '/MyControls/Web/GUI/Controls/PageHead.ascx' does not exist. at System.Web.UI.Util.CheckVirtualFileExists(VirtualPath virtualPath)Hey. I get this exeption on my Vista machine, this works fine on my XP machine. On both machines I use Visual Studio 2008, and both uses .Net Framework 3.5.
<!-- HttpException The file '/MyControls/Web/GUI/Controls/PageHead.ascx' does not exist. at System.Web.UI.Util.CheckVirtualFileExists(VirtualPath virtualPath)
at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
at System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
at System.Web.UI.BaseTemplateParser.GetReferencedType(VirtualPath virtualPath, Boolean allowNoCompile)
at System.Web.UI.BaseTemplateParser.GetUserControlType(VirtualPath virtualPath)
at System.Web.UI.MainTagNameToTypeMapper.ProcessUserControlRegistration(UserControlRegisterEntry ucRegisterEntry)
at System.Web.UI.BaseTemplateParser.ProcessDirective(String directiveName, IDictionary directive)
at System.Web.UI.TemplateControlParser.ProcessDirective(String directiveName, IDictionary directive)
at System.Web.UI.PageParser.ProcessDirective(String directiveName, IDictionary directive)
at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding) -->I have a prodject where my SomePage.aspx site is. On this page I have a refference to the usercontrol PageHead.ascx witch is located on another prodject.
<%@ Register TagPrefix="uc1" TagName="pageHead" Src="MyControls/Web/GUI/Controls/PageHead.ascx" %>
I've have added the web prodject to IIS and added the virtual path for the usercontrol prodjekt, and in the usercontrol prodjekt properies I've sat it to use the IIS Web server and to override the application root URL. Nothing of this has helped. Anyone know why? Thanks Thomas
-
Ajax/javascript problemYes, and it is OK with reslut = ""<table><tr><td>This is a test</td></tr></table>"
-
Ajax/javascript problemvar myTbody = $get("myTbody");
myTbody.html(result);gives me the objekt, thus the objekt does't support the method .html(..) (I can acully drop the "var myTbody = $get("myTbody");", since it findes it without it.) I thought maby I could use
myTbody.innerHTML = result;
But this gives me a "htmlfile: Unknown runtime error" exeption :(
-
Ajax/javascript problemI was on a session by Stephen Walther where he introdused client side ajax by a web service, the example was pritty simple:
<table cellpadding="0" cellspacing="0">
<thead>
<tr>
<td>
<asp:Button
id="btnShowDetails"
runat="server"
Text="test"
/>
</td>
</tr> </thead>
<tbody id="myTbody">
</tbody>
</table></div>
<script type="text/javascript">
function showText() {
AjaxWebService.MyWebService.Product.getText(showTextComplete);
}function showTextComplete(result) { $("myTbody").html(result); }
The web service return a simple string like "<table><tr><td>This is a test</td></tr></table>". The problem is in the function showTextComplete, I always get "Microsoft JScript runtime error: Object expected", it's the $("myTbody") that's wrong. When Walther showed it, it worked fine. So what em I doing wrong? Thanks Thomas
-
JavaScript problem for IE 6.0I have a javascript on my page that handels onkey event:
function OnKeyPress(evt)
{
if(this.GetKey(evt)==13)
{
var txtCtrl=this.GetTextBoxCtrl();
var sBtnIDtoClick=txtCtrl.getAttribute('btnIDtoClick');
if(sBtnIDtoClick != "")
{
var btnControl = document.getElementById(sBtnIDtoClick);
btnControl.click();
}
}
return true;
}This works fine in Internet Explorer 7.0 but not for IE 6.0. (The problem is that the
btnControl.click();
is not fired) All other JavaSripts works fine, like:
function OnKeyUp(evt)
{
var nKey;
nKey=this.GetKey(evt);if ((nKey!=38) && (nKey!=40) && (nKey!=13)) { var sNewValue; sNewValue=this.GetTextBoxValue();
}
}Anyone know why? Thanks Thomas
-
How to remove focus from a button.I had to replace the Buttons with LinkButtons
-
How to remove focus from a button.Hey. I have a search page containg 2 buttons and 2 textboxes. I have a javascript that cathces the enter-key event and triggers the respecting button, as in TextBox1 to Button1 and TextBox2 to Button2. My problem is that when I enter the page, the Button2 is allways in focus, no mather if I have the TextBox1 in focus or click on a CheckBox that is allsow have on the page. So when I hit the enter-key, the Button2.click event is allways triggerd. Does anyone know how to get around this. Thanks Thomas
-
Problem with Placeholder control [modified]Sorry, dident see the dgi. That is acculy not a problem, for in each datagriditem every label would have the id="lb2". as in:
DataGrid dg = new DataGrid();
dg.ID = "dgTheDataGrid";
dg.RunatServer = true;
DataGridItem dgi = new DataGridItem();
Lable lb2 = new Label();
lb2.ID = "lb2";
dgi.AddControl(lb2);
dg.AddControl(dgi);
PlaceHolder2.AddControl(dg);The syntax in this code is probably wrong, but something like this.
-
Problem with Placeholder control [modified]Yes, this would requier that you know the id. That's way I suggested that you add a DataGrid where each row(DataGridItem) would contain 1 Label and 1 Textbox
-
Problem with Placeholder control [modified]if you know the ID of the label and the textbox, the best solution will probably be this:
Lable lb2 = (Lable)PlaceHolder2.FindControl("lb2");
TextBox tb2 = (TextBox)PlaceHolder2.FindControl("tb2");
if(lb2 != null && tb2 != null)
{
SqlCommand cmdinsertliftunion = new SqlCommand("INSERT INTO table(field1, field2) VALUES ('" + lb2.Text + "', '" + tb2.Text + "')", con);
cmdinsert.ExecuteNonQuery();
}If you have multiple lables and textboxes in the placeholder and you don't know how many pairs of them you have. Then you probably need to make all of this in another way. I would recommand that you add a DataGrid to the placeholder and in the DataGrid you add pairs of lable and textbox. Then the code would look something like this.
DataGrid dg = (DataGrid)PlaceHolder2.FindControl("dgTheDataGrid");
foreace(DataGridItem dgi in dg.Items)
{
Lable lb2 = (Lable)dgi.FindControl("lb2");
TextBox tb2 = (TextBox)dgi.FindControl("tb2");
if(lb2 != null && tb2 != null)
{
SqlCommand cmdinsertliftunion = new SqlCommand("INSERT INTO table(field1, field2) VALUES ('" + lb2.Text + "', '" + tb2.Text + "')", con);
cmdinsert.ExecuteNonQuery();
}
}modified on Wednesday, October 8, 2008 9:20 AM
-
Problem with Placeholder control [modified]try
Label lb2 = new Label();
TextBox tb2 = new TextBox();
foreach (Control c in PlaceHolder2.Controls)
{... -
Problem with Placeholder control [modified]Are you adding multiple textboxes and labels to the placeholder? In that case you need to know witch of the labels og textboxes pair you wan't to insert.
-
Problem with Placeholder control [modified]The code
if (c.GetType().ToString().Equals("System.Web.UI.WebControls.TextBox"))
{spessifies that it only goes into the statment if it is an TextBox try
Label lb2;
TextBox tb2;
foreach (Control c in PlaceHolder2.Controls)
{
if (c.GetType().ToString().Equals("System.Web.UI.WebControls.TextBox"))
{
TextBox tb2 = (TextBox)c;
}
else if(c.GetType().ToString().Equals("System.Web.UI.WebControls.Label"))
{
lb2 = (Label)c;
}
}
}
SqlCommand cmdinsertliftunion = new SqlCommand("INSERT INTO table(field1, field2) VALUES ('" + lb2.Text + "', '" + tb2.Text + "')", con); cmdinsert.ExecuteNonQuery(); -
Problem with viewstate for listitemsThe code strValues += listbox1.Items[listbox1.Items.Count - 1].Value; is wrong becauce you will allways add the last item, no mather if it is selected. I would recomand the modefide answer I gave you. Do you redirect to the same page?