In my loop I am trying to remove items from a list that have a certain name. I can't do this with a for-each, so I tried a regular for-loop. It seems the for loop is not working as expected. It always goes over the limit. I had to put an if-then to break out of the loop (very ugly solution). I'm trying to find the correct way to accomplish this.
In my loop I am trying to remove items from a list that have a certain name. I can't do this with a for-each, so I tried a regular for-loop. It seems the for loop is not working as expected. It always goes over the limit. I had to put an if-then to break out of the loop (very ugly solution). I'm trying to find the correct way to accomplish this.
Dim canShowNextTable As Boolean = False Dim allTablesInTab As List(Of Control) = ctrlFinder.GetTypeOfControls("Table", parentForm.Controls) Dim totalTables As Integer = allTablesInTab.Count - 1 For i As Integer = 0 To totalTables
We have a project that needs to gather survey data. On one particular page of the website, there are 21 questions each with a scale of 1-5 where the user selects one radio button for each question in the table.
The survey is being coded in VB.NET. The data submits to an SQL database. All the radio buttons are similarly named, so only the number changes for the question -- thinking this would make it easier on the back end coding. In the code behind I was hoping to do something to the effect:
We have a project that needs to gather survey data. On one particular page of the website, there are 21 questions each with a scale of 1-5 where the user selects one radio button for each question in the table.
The survey is being coded in VB.NET. The data submits to an SQL database. All the radio buttons are similarly named, so only the number changes for the question -- thinking this would make it easier on the back end coding. In the code behind I was hoping to do something to the effect:
For i = 1 To 21 If rbLWHFQ_Q(i)A1.Checked Then myCommand.Parameters.AddWithValue("@LWHFQ_Q(i)", rbLWHFQ_Q(i)_A1.Value) ElseIf rbLWHFQ_Q(i)_A2.Checked Then myCommand.Parameters.AddWithValue("@LWHFQ_Q(i)", rbLWHFQ_Q(i)_A2.Value) ElseIf rbLWHFQ_Q(i)_A3.Checked Then myCommand.Parameters.AddWithValue("@LWHFQ_Q(i)", rbLWHFQ_Q(i)_A3.Value) ElseIf rbLWHFQ_Q(i)_A4.Checked Then myCommand.Parameters.AddWithValue("@LWHFQ_Q(i)", rbLWHFQ_Q(i)_A4.Value) ElseIf rbLWHFQ_Q(i)_A5.Checked Then myCommand.Parameters.AddWithValue("@LWHFQ_Q(i)", rbLWHFQ_Q(i)_A5.Value) ElseIf rbLWHFQ_Q(i)_A6.Checked Then myCommand.Parameters.AddWithValue("@LWHFQ_Q(i)", rbLWHFQ_Q(i)_A6.Value) ElseIf rbLWHFQ_Q(i)_A7.Checked Then myCommand.Parameters.AddWithValue("@LWHFQ_Q(i)", rbLWHFQ_Q(i)_A7.Value) ElseIf rbLWHFQ_Q(i)_A8.Checked Then myCommand.Parameters.AddWithValue("@LWHFQ_Q(i)", rbLWHFQ_Q(i)_A8.Value) ElseIf rbLWHFQ_Q(i)_A9.Checked Then myCommand.Parameters.AddWithValue("@LWHFQ_Q(i)", rbLWHFQ_Q(i)_A9.Value) ElseIf rbLWHFQ_Q(i)_A10.Checked Then myCommand.Parameters.AddWithValue("@LWHFQ_Q(i)", rbLWHFQ_Q(i)_A10.Value) End If Next i
My research tells me that it's not possible to do what I am wanting without some special coding. I've seen mention of arrays in relation to these types of questions elsewhere, but I'm not familiar enough with arrays to see how they would work in this case.
Am I just going to have to create 21 sets of If...Else statements? :(
Here's what the HTML looks like for a question, if that matters:
As an aside, I know about RadioButtonLists, but in this case I'm needing to style the radio buttons in a special way and can't get it to work when ASP renders the list items.
Updated to show I used it in my code I'm not sure how StackOverflow works with regards to showing how something worked for you, but I just wanted to add this in case others come here looking for the answer. Basically, I used the code below:
Dim radioButtons()() As HtmlInputRadioButton = { _ New HtmlInputRadioButton() {rbLWHFQ_Q1_A1, rbLWHFQ_Q1_A2, rbLWHFQ_Q1_A3, rbLWHFQ_Q1_A4, rbLWHFQ_Q1_A5, rbLWHFQ_Q1_A6}, _ New HtmlInputRadioButton() {rbLWHFQ_Q2_A1, rbLWHFQ_Q2_A2, rbLWHFQ_Q2_A3, rbLWHFQ_Q2_A4, rbLWHFQ_Q2_A5, rbLWHFQ_Q2_A6}, _ }
I created an array with the radio button group names:
Dim radioButtonGroupNames() As String = { _ "@LWHFQ_Q1", _ "@LWHFQ_Q2", _ }
Then in my For...Loop I used:
For i = 0 To 20 If radioButtons(i)(0).Checked Then myCommand.Parameters.AddWithValue(radioButtonGroupNames(i), radioButtons(i)(0).Value) ElseIf radioButtons(i)(1).Checked Then myCommand.Parameters.AddWithValue(radioButtonGroupNames(i), radioButtons(i)(1).Value) ElseIf radioButtons(i)(2).Checked Then myCommand.Parameters.AddWithValue(radioButtonGroupNames(i), radioButtons(i)(2).Value) ElseIf radioButtons(i)(3).Checked Then myCommand.Parameters.AddWithValue(radioButtonGroupNames(i), radioButtons(i)(3).Value) ElseIf radioButtons(i)(4).Checked Then myCommand.Parameters.AddWithValue(radioButtonGroupNames(i), radioButtons(i)(4).Value) ElseIf radioButtons(i)(5).Checked Then myCommand.Parameters.AddWithValue(radioButtonGroupNames(i), radioButtons(i)(5).Value) End If Next i
i am trying to collect 2 variables from one hyperlink, and use those variables in the page_load to set as session. but i don't know how to collect those 2 variables
i would like to collect '#FF0000','#FFE4E1' or direct set '#FF0000','#FFE4E1' to string then send to pageload, how can i do this by only clicking on it ?
I have this code in javascript: var x = e.mapX; It gets the X-coordinate of a map. What I want to do is that I want to store this into a c# variable. I have a class named Test with an integer property X. I want to store var x into X. In the codebehind, I have this on the Page_Load: Test test = new Test(); Then I am trying this on the javascript code: var x = e.mapX;
Im stuck with declaring a string which is in a loop within another loop.
Dim CompanyDetails As String = "" Dim CompanyRow As DataRow For Each CompanyRow In newdt.Rows CompanyDetails += CompanyRow(1) & " " & CompanyRow(0) & "<br/>"...
How can I get this to see the GetInfo as declared..... since its in a loop within a loop?
whats the exact use of static variables in overall programming in .net and for asp.net...
Recently i went for the interview where interviewer asked me 2 question which i was not sure for the same..
whats the use of session object, i said sessions are the server side object, they are used when you want to store user specific data at server side, then he asked what if i want to use static variables for the same, i was mum, can anyone tell me how asp.net will behave if i store the user specific information in static variables.If i use cookies which are the best option to store the data at client side (not sensitive one), but what if user has disabled cookies on his machine, will my application would crash.
With the System.IO.Compression i am able to convert a file to zip but how to make it password protected. I dont want to use any third-party library or dll. Is it possible to make a file password protected within c#. do not provide the link that doesn't meet above scenario.
I am trying to get this to bind to a gridview, without any luck. I would like each asynctask to ultimately return seperate datasets, but for now I can deal with the same one being returned.
I have a website that has anonymous authentication enabled. Now for a particular folder I want the users to be logged in with a userid and password. The user id and password is going to be same for everyone.
Eg user id is TEST and Password is answer. How can I do that?
I went in to that folder ->properties->directory security->edit-> And I disabled the anonymous access
But where should I add the User Id and Password? Under which option.
Having a ModalPopupExtender, the idea is to run a delete process from a SqlDataSource when Cancel button is clicked.
Our approach is as showed below:
<script type="text/javascript"> function deleteRec() { alert("Call a Protected Sub btnNo_Click!"); } </script> <asp:ModalPopupExtender ID="Panel1_ModalPopupExtender" runat="server" PopupControlID="Panel1" DynamicServicePath="" Enabled="True" TargetControlID="btnFirePopup" BackgroundCssClass="modalBackground" Drag="true" DropShadow="true" OkControlID="btnYes" CancelControlID="btnNo" OnCancelScript="deleteRec()" > </asp:ModalPopupExtender> Protected Sub btnNo_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnNo.Click TempDB.Delete() End Sub
First question: It's that correct?
Second Question: Is so, how do we call a Protected Sub from JavaScript?
I'm running IIS 6 with ASP.NET 2.0.I enabled windows authentication for a folder in a website and gave permissions to a user. When I navigate to the page, the passowrd prompt pops up as expected and when entered correctly, the page loads. The page contains a file upload control. When I try to upload a file, the password prompt keeps popping up. ultimately it ends up as a 401 error. The user account does have write permissions to the floder, so I'm not understanding why I can get to the page with the credentials, but can't upload anything to that folder.
i have table data which i am currently writing to an excel file, but i need to be able to securely password protect the file. Ive been told excel passwords are easy to break, so is there another file type which i can dynamically write to and password protect for emailing elsewhere (and requiring receiver to type password in to access it)?
how can we attached secure PDF to mail in asp.net ...(Means when we attache any pdf to mail after getting mail at d opening of pdf it should ask password..)
I want to make my web.config password protected so that external users do not open it. But my application should be able to access. Is there any way to do this?
I'm looking to deploy a web app and I have a simple question about the <location> tag of the web.config file. For the moment, I want all the pages to be password protected and I've created a simple login page with the login object. I've put all my .aspx file in a directory called AppMyPages and I've put this in the config file: