|
I think he wants to "Postback" to a new page and not re-direct to a new page.
|
|
|
|
|
The Postback url defaults to the current page and this is where your first click will return to, because, at this first click point your browser doesn't know to postback to NewPage.aspx. Only on the second click (after you've set Button1.PostBackUrl = "NewPage.aspx") will you get postback to the new page.
IF YOU NEED TO POSTBACK TO A DIFFERENT PAGE THEN....
you can't avoid using javascript. Setting PostBackUrl on the server won't affect the current request (your first click).
IF YOU'RE NOT REALLY CONCERNED WITH POSTBACK THEN....
do what the other guys suggested and replace the Button1.PostBackUrl = "NewPage.aspx" with the ReDirect, or Server.Transfer("NewPage.aspx"); code.
|
|
|
|
|
Here's my problem: I have a button and when I click it I want to open a new page. I know that I can do this thing very easy by setting the PostBackUrl property of the button. But here's what I want to do: on my page I have a textbox and, for example when I press the button I want to test the text from the TextBox and if it's ok I want to show the new page; if not I want to display a message. I want to do that using c# language, and not JavaScript. I've tried this:
<br />
protected void Button1_Click(object sender, EventArgs e)<br />
{<br />
if (TextBox1.Text == "something")<br />
Button1.PostBackUrl = "NewPage.aspx";<br />
else<br />
....................<br />
<br />
}<br />
<br />
Can anyone help me please?
|
|
|
|
|
if i understand you correctly , when the Textbox value is equal to what you want a use to be transfered to another page else show the message(Error), if so , then you can do it this way
protected void Button1_Click(object sender, EventArgs e)
{
if (TextBox1.Text == "something")
{
Response.Redirect("NewPage.aspx",false);
}
else
{
}
}
Hope this is what you are looking for. One more thing , Dont post the same thing twice , its not allowed here.
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Hi,
I am working on a asp.net application. In this I want a javascript function which have to invoke Anchor tag click event without clicking in asp.net.
If anyone have any idea to do this please reply me.
Thanks in advance.
|
|
|
|
|
|
use
location.href=document.getElementById('myanchor').href;
I think this is what you needed.
|
|
|
|
|
Hi I have a css class
.gridHeader
{
background-image:url('images/hdr.gif');
}
now I have set the "HeaderStyle-CssClass" property of Gridview to "gridHeader".
In design view the header image comes properly.But when I browse the page in browser the header image disappears.
CC26
|
|
|
|
|
Its may be due to the browser..!
Delete history cache and all the files in the browser and try again..!
If you still have the problem let me know..!
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
I tested with various browsers....IE,Mozila,Chrome
but the result is the same
CC26
|
|
|
|
|
Hi,
almost every browser has a developer tool. Use it to track the images, css and stuff like that.
|
|
|
|
|
where is your css file..!
If it is in the root ..!then it should work
if it is in the folder lets say its in
App_Themes/Theme1/StyleSheet.css
then You have to give
background-image:url(../../images/button4.gif);
depending on the folder..!
one../ should be used..!
if you still has the problem as petr suggests open it in browser and view page source..! and check the image
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
THE CSS file is in the root only.
The browser page source for gridview header row is given below.it seems ok only.
<table cellspacing="0" cellpadding="4" rules="cols" border="1" id="ctl00_ContentPlaceHolder1_grdSoData" style="color:#333333;font-family:Times New Roman,Arial;font-size:Small;border-collapse:collapse;">
<b><tr class="gridHeader"></b> <th scope="col"><a href="javascript:__doPostBack('ctl00$ContentPlaceHolder1$grdSoData','Sort$COLUMN1')" style="color:#333333;">COLUMN1</a></th>
<th scope="col"><a href="javascript:__doPostBack('ctl00$ContentPlaceHolder1$grdSoData','Sort$COLUMN2')" style="color:#333333;">COLUMN1</a></th>
<tr>
I have cleared the browser cache also.But nothing worked.
CC26
|
|
|
|
|
I tried just now its working good..!
First for me also didnt waork i deleted all the cache objects and it worked now..!
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
THE CSS file is in the root only.
The browser page source for gridview header row is given below.it seems ok only.
<table cellspacing="0" cellpadding="4" rules="cols" border="1" id="ctl00_ContentPlaceHolder1_grdSoData" style="color:#333333;font-family:Times New Roman,Arial;font-size:Small;border-collapse:collapse;">
<b><tr class="gridHeader"></b> <th scope="col"><a href="javascript:__doPostBack('ctl00$ContentPlaceHolder1$grdSoData','Sort$COLUMN1')" style="color:#333333;">COLUMN1</a></th>
<th scope="col"><a href="javascript:__doPostBack('ctl00$ContentPlaceHolder1$grdSoData','Sort$COLUMN2')" style="color:#333333;">COLUMN1</a></th>
<tr>
I have cleared the browser cache also.But nothing worked.
CC26
|
|
|
|
|
|
Hi All,
According to our requirement we are showing highslide when we click on button,this button which is a control of a datalist.we are getting the highslide with the necessary information when we click on the button.
But the thing is when we click on "prev"/"Go back" button of the browser which we can see in all browsers.
It is again loading the highslide,where we are calling the function in the Button "showhighslide".
I dont know what might be the problem?
Can any one help me?
Thankyou In Advance.
|
|
|
|
|
I didnt use High slide ..!
But If u want for picture views ..?
I saw a beautiful control or js for picture presentation i.e. LightBox..!
If Interested click the below link..!
http://www.huddletogether.com/projects/lightbox2/[^]
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
Hi,
I am using asp.net multiview control in one of my forms.Here the prob is - some controls in each view contains dot net validation controls.They are getting fired when I navigate throw the multiview. Please provide the solution for this.
Thanks,
Srinivas Mateti
9440071311
|
|
|
|
|
Make it as a single group
by keeping ValidationGroup name=same for the validators and buttons..!
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
Using whatever control you are navigating through the MultiView...just set the following property of that control
CausesValidation=false
CC26
|
|
|
|
|
Hi! I have a few problems. I have a panel and I want to implement the "mouse_over" method. I managed to implement the "mouse_click" method, because as you know asp.net doesn't provide these methods for a Panel. And also I would like to change the mouse sensitivity while my mouse is over the panel. Can anyone help me please? Any idea is appreciated..
|
|
|
|
|
|
As Petr said, use the DIV tag instead of ASP:Panel. Sometimes panel will not work properly in some browsers, eg.IE8
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
Hi,
I just write one more comment if I may ... ASP.NET Panel is DIV. It is rendered as DIV element into DOM. You can use it, there is no doubt about it. Even though there is no intellisense in VS for "onmouseover" it will works well.
<asp:Panel runat="server" ID="pnlPanel" onmouseover="javascript: myAction();">...
|
|
|
|