|
The right way, is to make pages 1-5 all controls, put them all on the same page, and then you can use viewstate to store values and pass them between 'pages'
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Are you a winforms programmer? Designing web pages like this will be a burden to the end user. You can use session variables, query strings or cross page posting to pass data one form to another.
|
|
|
|
|
Can anybody guide me how to use Ajax Shopping Cart in ASP.NET.............
|
|
|
|
|
Do you mean you've bought or found a component ? Read the manual. Do you mean you want to write one ? Get to work, no-one is going to write it for you.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi,
There are some text boxes , one "back" and one "reset" button on screen.
One text box is employee id. After entering employee id, it populates the rest details in other text boxes. This code is written in text_changed event. it works fine.
Issue is with following scenario:
Suppose I enter emp id in text box and directly jump to Back button and click it. Now text_changed event take place, rest of details will be populated, we will not go to back page. We will have to reclick back button to go back. Same holds true for reset.
So how to avoid this i.e. data should not be populated when we directly jump from text box to back button, should go to back page. same for reset button.
|
|
|
|
|
What are you doing to go back to previous page?
Could you please provide the code.
|
|
|
|
|
I let u know about a simple reproducable code.
Drag an asp text box control.
Drag an HTML button control.
Make the autopost back of textbox=TRUE
protected void TextBox2_TextChanged(object sender, EventArgs e)
{
Response.Write("hi");
}
function Button1_onclick() {
alert('clicked button');
}
Run it. Enter any text in text box and click on button. Button will display "hi", it will not trigger its own event. So I want that on button click, TextBox2_TextChanged event should not take place. IN any other condition, it shold work fine.
|
|
|
|
|
amittinku wrote: Drag an asp text box control.
Drag an HTML button control.
Well, that sucks. Anyone who uses the designer, is obviously on the wrong track. The designer sucks.
amittinku wrote: So I want that on button click, TextBox2_TextChanged event should not take place. IN any other condition, it shold work fine.
That sounds like a real bug in ASP.NET. I assume you have other buttons, which would still fire the text changed ? It's a real bug if the text change event on the server, stops the client side onclick from working. Perhaps instead of using OnClientClick, you should use onclick directly ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi Christian,
You are right. After entering emp id in text box, if i directly click on any button, textchanged event takes place. So could not get any solution yet how to stop textchanged event if we click on a button.
Note:As button is HTML control, so i am using onclick event only.
|
|
|
|
|
So perhaps you need to use an ASP.NET button for it to hook into the ASP.NET events engine properly ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
whether use asp button or html button, does not matter.
|
|
|
|
|
You're saying that ASP.NET is fundamentally broken. I'd google to see what other people have done, because surely other people have had the same issue.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
This happens because in asp textbox if AautoPostBack is set to true, page is posted back when user leaves the control ( here textbox). So basically, when you click the button, first you leave the textbox control and then you click on the button. Hence TextBox' postback the data to server and as the page is reloaded you dont see any alert message. Subsequent click on button shows the alert message.
I just replicated your situation.
<asp:TextBox ID="TextBox1" runat="server" AutoPostBack="true" ontextchanged="TextBox1_TextChanged"></asp:TextBox>
<input type="button" id="btnOK" value="OK" onclick="return Button1_onclick();"/>
<script language="javascript" type="text/javascript">
function Button1_onclick()
{
alert('clicked button');
return false;
}
</script>
Thanks,
Arindam D Tewary
|
|
|
|
|
Of course, that's what auto postback means.
I've never used it, so I didn't really think it through, I just assumed that the event fired when he pushes a button to post back.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
That I got. But what's the solution?
|
|
|
|
|
Do anyone use shared variable in their ASP projects?
|
|
|
|
|
Hi All,
U can use shared variable if u have requirment.one place u can use i think where u want to display how many user logged in currently in ur website
Thanks and regards
Amit Patel
|
|
|
|
|
I have found a problem with shared variable, same variable is used if you open two tabs with the same url.
|
|
|
|
|
Thats right, you'll face this problem.
You can use Session variables in place of Shared.
|
|
|
|
|
Same problem with session, thats why i use shared.
modified on Tuesday, October 6, 2009 4:10 AM
|
|
|
|
|
No Way, how are you using them?
Can you show your code?
|
|
|
|
|
shared shouldnt be referenced in both tabs, both tabs should have their own.
|
|
|
|
|
I don't think this is true. Shared variable is common.
In my beginnings days, i also used Shared variable but then i got same problem. Then i used Session variables which solved my problem.
Basic thing is, for what purpose you are using Shared or Session variables.
|
|
|
|
|
I used shared variable to store User ID that I reference in different instances. What i understand is that two different tabs runs same class but all variables are initialized, in other words both tabs runs the sam class but variables are not the same.
|
|
|
|
|
Blikkies wrote: two different tabs runs same class but all variables are initialized
This is what i am telling you, opening a new tab will initialize all variables but not shared variable, shared variable will retain its previous value. I also used shared variable for storing user ids and i got stuck up.
Try to use Session Variables, assign session variable after successful login, it won't definitely repeat on new tab.
|
|
|
|