|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Help with C# using popup poxI have a form that people enter their 9 digit account numbers and hit submit to email them to me. They have option of up to 4 different account numbers to enter, (4 text boxes). When they hit submit, it opens a new popup window that says congratulations. What I need to accomplish is to calculate how many account numbers they entered (1,2,3, or 4) and put that into that popup. So it would say 'thank you for entering X number of accounts'. Belows is how I do the popup. In server side .cs page: string url = "cwbpopup.html"; RegisterStartupScript("OpenWin", "<script>openNewWin('" + url + "')</script>");In client side .aspx page: <asp:button id="btnSubmit" runat="server" Text="Submit" onclick="btnSubmit_Click" CssClass="button" tabIndex="19"></asp:button> Thank you in advance. "Artunc" <Art***@discussions.microsoft.com> wrote in message I would strongly advise you NOT to pop up new windows, especially in public news:1411CE7E-4DC1-41B1-8353-18B1FED1A304@microsoft.com... > I have a form that people enter their 9 digit account numbers and hit > submit > to email them to me. They have option of up to 4 different account numbers > to > enter, (4 text boxes). When they hit submit, it opens a new popup window > that says congratulations. web sites. Instead, I would suggest that you use this: http://www.asp.net/ajax/ajaxcontroltoolkit/samples/modalpopup/modalpopup.aspx > RegisterStartupScript("OpenWin", "<script>openNewWin('" + url + If you absolutely must do the above, then I would suggest that you use the > "')</script>"); boolean overload which will inject the correct standards-compliant <script> tags automatically depending on the DOCTYPE you're using, e.g. RegisterStartupScript(GetType(), "OpenWin", "openNewWin(" + url + ");"), true); Thanks Mark, I will take a look at you suggestions.
What I'm trying to figure out is how to determine how many entered on the server side, and then pass that number to a sub-page or popup. Show quoteHide quote "Mark Rae [MVP]" wrote: > "Artunc" <Art***@discussions.microsoft.com> wrote in message > news:1411CE7E-4DC1-41B1-8353-18B1FED1A304@microsoft.com... > > > I have a form that people enter their 9 digit account numbers and hit > > submit > > to email them to me. They have option of up to 4 different account numbers > > to > > enter, (4 text boxes). When they hit submit, it opens a new popup window > > that says congratulations. > > I would strongly advise you NOT to pop up new windows, especially in public > web sites. > > Instead, I would suggest that you use this: > http://www.asp.net/ajax/ajaxcontroltoolkit/samples/modalpopup/modalpopup.aspx > > > > RegisterStartupScript("OpenWin", "<script>openNewWin('" + url + > > "')</script>"); > > If you absolutely must do the above, then I would suggest that you use the > boolean overload which will inject the correct standards-compliant <script> > tags automatically depending on the DOCTYPE you're using, e.g. > > RegisterStartupScript(GetType(), "OpenWin", "openNewWin(" + url + ");"), > true); > > > -- > Mark Rae > ASP.NET MVP > http://www.markrae.net > > "Artunc" <Art***@discussions.microsoft.com> wrote in message [please don't top-post]news:7B97A52D-BB80-409F-A8E4-E56FE00D19C6@microsoft.com... http://www.caliburn.nl/topposting.html >> I would strongly advise you NOT to pop up new windows, especially in Can't you just count the number of textboxes which aren't blank...>> public >> web sites. >> >> Instead, I would suggest that you use this: >> http://www.asp.net/ajax/ajaxcontroltoolkit/samples/modalpopup/modalpopup.aspx > What I'm trying to figure out is how to determine how many entered on the > server side, and then pass that number to a sub-page or popup. I have the below code for each of 4 account boxes. How to count each box
that has some numbers entered is my question. :-) <td class="formHeader" align="right"><P align="left">Account Number 1:</P></td> <td><asp:textbox id="Accntbox1" runat="server" class="text" tabIndex="12" MaxLength="25"></asp:textbox></td> Show quoteHide quote "Mark Rae [MVP]" wrote: > "Artunc" <Art***@discussions.microsoft.com> wrote in message > news:1411CE7E-4DC1-41B1-8353-18B1FED1A304@microsoft.com... > > > I have a form that people enter their 9 digit account numbers and hit > > submit > > to email them to me. They have option of up to 4 different account numbers > > to > > enter, (4 text boxes). When they hit submit, it opens a new popup window > > that says congratulations. > > I would strongly advise you NOT to pop up new windows, especially in public > web sites. > > Instead, I would suggest that you use this: > http://www.asp.net/ajax/ajaxcontroltoolkit/samples/modalpopup/modalpopup.aspx > > > > RegisterStartupScript("OpenWin", "<script>openNewWin('" + url + > > "')</script>"); > > If you absolutely must do the above, then I would suggest that you use the > boolean overload which will inject the correct standards-compliant <script> > tags automatically depending on the DOCTYPE you're using, e.g. > > RegisterStartupScript(GetType(), "OpenWin", "openNewWin(" + url + ");"), > true); > > > -- > Mark Rae > ASP.NET MVP > http://www.markrae.net > > "Artunc" <Art***@discussions.microsoft.com> wrote in message [please don't top-post]news:B24963A7-7531-47DE-9414-6558953D527B@microsoft.com... http://www.caliburn.nl/topposting.html > I have the below code for each of 4 account boxes. How to count each box Client-side:> that has some numbers entered is my question. :-) > > <td class="formHeader" align="right"><P align="left">Account Number > 1:</P></td> > <td><asp:textbox id="Accntbox1" runat="server" class="text" tabIndex="12" > MaxLength="25"></asp:textbox></td> document.getElementById('<%=Accntbox1%>').value.length; Server-side: Accntbox1.Text.Length; "Mark Rae [MVP]" <mark@markNOSPAMrae.net> wrote in message Apologies, that should be:news:uxDvBCb%23JHA.2872@TK2MSFTNGP05.phx.gbl... > Client-side: > document.getElementById('<%=Accntbox1%>').value.length; document.getElementById('<%=Accntbox1.ClientID%>').value.length;
Show quote
Hide quote
"Mark Rae [MVP]" wrote: I'm not sure this is what I'm trying to do. Correct me if I'm wrong, your > "Artunc" <Art***@discussions.microsoft.com> wrote in message > news:B24963A7-7531-47DE-9414-6558953D527B@microsoft.com... > > [please don't top-post] > http://www.caliburn.nl/topposting.html > > > I have the below code for each of 4 account boxes. How to count each box > > that has some numbers entered is my question. :-) > > > > <td class="formHeader" align="right"><P align="left">Account Number > > 1:</P></td> > > <td><asp:textbox id="Accntbox1" runat="server" class="text" tabIndex="12" > > MaxLength="25"></asp:textbox></td> > > Client-side: > document.getElementById('<%=Accntbox1%>').value.length; > > Server-side: > Accntbox1.Text.Length; > code counts the digits in the account box. What I need is to count each box that has value in it as one and come up with a total number in the end. If 3 account numbers in box 1,2 and 3, then the value would be 2. I'm thinking of something like below but I don't know how to count each one and get a total in the end. String.IsNullOrEmpty(Accntbox1.Text) "Artunc" <Art***@discussions.microsoft.com> wrote in message That's right - and if the answer is greater than zero, then you know that news:75E8DD63-5733-4F53-A277-BB0D5A9D67A1@microsoft.com... > I'm not sure this is what I'm trying to do. Correct me if I'm wrong, your > code counts the digits in the account box. textbox has a value in it... > I'm thinking of something like below but I don't know how to count each byte bytBoxCount = 0;> one > and get a total in the end. if (Accntbox1.Text.Length > 0) { bytBoxCount++; } if (Accntbox2.Text.Length > 0) { bytBoxCount++; } if (Accntbox3.Text.Length > 0) { bytBoxCount++; } if (Accntbox4.Text.Length > 0) { bytBoxCount++; } Thank you very much, I will try this and post the results here.
Show quoteHide quote "Mark Rae [MVP]" wrote: > "Artunc" <Art***@discussions.microsoft.com> wrote in message > news:75E8DD63-5733-4F53-A277-BB0D5A9D67A1@microsoft.com... > > > I'm not sure this is what I'm trying to do. Correct me if I'm wrong, your > > code counts the digits in the account box. > > That's right - and if the answer is greater than zero, then you know that > textbox has a value in it... > > > I'm thinking of something like below but I don't know how to count each > > one > > and get a total in the end. > > byte bytBoxCount = 0; > > if (Accntbox1.Text.Length > 0) { bytBoxCount++; } > if (Accntbox2.Text.Length > 0) { bytBoxCount++; } > if (Accntbox3.Text.Length > 0) { bytBoxCount++; } > if (Accntbox4.Text.Length > 0) { bytBoxCount++; } > > > -- > Mark Rae > ASP.NET MVP > http://www.markrae.net > > "Artunc" <Art***@discussions.microsoft.com> wrote in message [please don't top-post]news:93356D61-DB17-4144-A328-806CEEB6C4ED@microsoft.com... > Thank you very much, I will try this and post the results here. http://www.caliburn.nl/topposting.html I can't get the number to show up in the popup.html page.
Ok here's what I have so far. Please let me know if I'm on the right track. In the main form page: <script> function openNewWin(url) { var x = window.open('popup1.html', 'mynewwin', 'width=725,height=380',Toolbar=1); x.focus(); } </script> In the .cs file: byte bytBoxCount = 0; if (txtTextbox2.Text.Length > 0) { bytBoxCount++; } if (txtTextbox4.Text.Length > 0) { bytBoxCount++; } if (txtTextbox6.Text.Length > 0) { bytBoxCount++; } if (txtTextbox8.Text.Length > 0) { bytBoxCount++; } string url = "popup1.html?NumberOfTextBoxes=" + bytBoxCount.ToString(); RegisterStartupScript("OpenWin", "<script>openNewWin('" + url + "')</script>");In the popup1.html file: var bytBoxCount = bytBoxCount.ToString(); <a onClick="self.close();" target="_blank">Thank you for entering <%bytBoxCount%> number of accounts<a /><br> Show quoteHide quote "Mark Rae [MVP]" wrote: > "Artunc" <Art***@discussions.microsoft.com> wrote in message > news:93356D61-DB17-4144-A328-806CEEB6C4ED@microsoft.com... > > > Thank you very much, I will try this and post the results here. > > [please don't top-post] > http://www.caliburn.nl/topposting.html > > > -- > Mark Rae > ASP.NET MVP > http://www.markrae.net > >
Other interesting topics
Commented codes still affect the program
Web Deployment Project - Publish? Displaying a generated picture in MS Word Image does not fit correctly in a div frame Multiple Select commands Localization issue with master page. Boundfield display value How to get an https url when using Forms and Default login redirect BUG? Repeating tag syntax in VS 2008 source mode...? GDI+ and font sizes |
|||||||||||||||||||||||