Forms Data Controls :: Get Correct Checked Answer?
Sep 29, 2010
I am still studying to become a webintegrator and this is my private project to try and learn C# better.
I have a database with a table called Answers which holds AnswerID, Answer1, Answer2, Answer3 and CorrectAnswer + a table called Questions which holds QuestionID, QuestionNumber and QuestionText.
On a page i have a repeater that pulls the questions from the database and inside it i have another repeater with my 3 radiobuttons that pulls the 3 Answers from the database and are grouped so you can only check 1 of the radiobuttons as the user. See below:
<asp:Repeater ID="rptQuestions" runat="server">
<ItemTemplate>
<div>
<div>
Spørgsmål
<asp:Label ID="lblQuestionHeader" runat="server" Text='<%#Eval("QuestionNumber") %>'></asp:Label>
[Code]...
What i need to do, is somehow find each CorrectAnswer checked correctly in the repeater holding the radiobuttons and give 1 point for each CorrectAnswer chosen by the user (if theres 10 questions there will be 10 repeateritems with 3 radiobuttons in each one) and write this into aspnet_Profile. Problem is i have no idea how to do this since it already seems a bit complicated in my head and i haven't had much C# yet. So any help would do and notice i do not ask for the entire coding but simply a push in the right direction.
View 2 Replies
Similar Messages:
Jul 4, 2010
how to count the number of incorrect words from the answer from the website when comparing with database answer?
View 10 Replies
Jun 3, 2010
currently im trying to implement a quiz system on my website in which system will auto mark student's ans. if the student's ans is wrong, system will prompt an incorrect answer, highlight the errors and count the number of errors.
Im using asp.net C#.
View 6 Replies
May 3, 2010
It doesn't seem that the Html.CheckBoxFor helper adds the correct "checked" attribute when rendering the HTML. I have a bool property rendered like so:
<%= Html.CheckBoxFor(m => m.Visible) %>
And the outputted HTML is this:
<input type="checkbox" value="true" name="Visible" id="Visible">
Is there some particular reason it does not add the "checked" attribute when the value is true?
View 1 Replies
May 3, 2010
I have a GridView that I was previously populating via an ObjectDataSource, and this code was working perfectly (ie, when the checkbox was checked Checkbox.Checked = true):
CODE BEHIND:
[Code]....
[Code]....
View 9 Replies
Mar 11, 2011
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chkRDR1" runat="server"/>
</ItemTemplate>
</asp:TemplateField>
=========================================================================================
Dim checkbox As CheckBox = CType(row.FindControl("chkRDR1"), CheckBox)
View 2 Replies
Mar 6, 2011
I am using 3 tables and are trying to get the correct info belonging to the correct id. Like this: I go to a page and here i want to see the information from the 3 tables using a specific id.
I have written this so far in a query:
[Code]....
My problem is that the last line does not work and i am uncertain how to make this work? How to write it correctly that is.
View 2 Replies
Apr 7, 2010
I have loaded up a gridview object with data. I have turned on Edit on the grid. It lets me edit the data, but I also want to put some code to check for correct data in each field. I tried to assign a requiredfieldvalitor, comparevaliditor but they don't work. Is there an event I can capture to fire up some code before the grid sves my data?
View 3 Replies
Nov 7, 2010
Are we using 'MyDataGrid' in the correct syntax to insert data
Code behind reads:
[Code]....
The front code [URL] for the Gridview reads:
[Code]....
View 18 Replies
May 2, 2010
i made a small n-tier webapplication, a DATA project with my business objects a DA project with my datacces logic and a GUI project woth my website. For the CRUD operations on my main tables I use a lot of listviews, that works fine but when data grows its slows down.I used already used optimal paging & shared collection's to preventing database acces if data is already loaded en that helps alot.But I see when a user select the EDIT command the select of my listview is performed what is not needed, also when the user than select cancel the select is again called , is this normal behavior or do I made a mistake in program logic somewhere because this behavior is slowing my application down.
View 1 Replies
Mar 31, 2010
Im new in datalist and im trying to programmatically bind my database data to my datalistMy problem is, i only able to show the Property Name and description on the ItemTemplateWhen i click on one item to switch to SelectedItemTemplate, most of the information is nothing In my code behind, i got this
[Code]...
View 8 Replies
May 4, 2010
[Code]....
and how to use both of those checkbox (for example: when i click update in my detailsview, if the checkbox is checked will return 1 and if unchecked will return 0 and insert that value to database)
View 2 Replies
Jun 15, 2010
Label1.text = CType(GridView_MyAds.FindControl("ItemId")
I need this correctly done....
View 2 Replies
Oct 7, 2010
I am trying to get the delete to work on my gridview. I've added a
DataKeyNames="ID"
but when i click delete i get Input string was not in a correct format.
View 7 Replies
Aug 11, 2010
there is a template field in gridview this is basically for showing amount.
<asp:TemplateField HeaderText="Amount" ConvertEmptyStringToNull="False">
<ItemTemplate>
<%#GetQTY1(float.Parse(Eval("Sub_ContractAmt").ToString())).ToString("N2")%>
</ItemTemplate>
</asp:TemplateField>
if my data base field has any value then it shows no error. but if this fiels is null then it shows error
input string was not in correct format while binding the gridview.
so can you please tell me the method that if this field has null value then what should I do so that i dont get this error. this fields might be null.
View 8 Replies
Mar 5, 2011
I'm stumped on this one... it seems really simple, but I can't get around it. I am pulling 2 values (discount percent, discount amount) from a formview label control. I want to use these numbers in a calculation, but I can't seem to get the format correct.
I hit the error on this statement:
DiscountAmt = Convert.ToDouble(fvDiscountResults.FindControl(
"DiscountSubtotal1"
).ToString)
[Code]....
View 2 Replies
Oct 18, 2010
I have a listview (userid, users) and a checkbox. I would like to select the checkbox and store the userid in a textbox then into a session page. I am having issues with the code as it seems incorrect, due to the listview1.row.
[Code]....
View 3 Replies
Oct 27, 2010
[Code]....
I've used only linkbutton and I do not know if what influence it.
View 3 Replies
Jul 8, 2010
I am getting "input string not in correct format" error and I have tried a few variations and still no dice. zSessvar1 is equal to 159 and when I substitute the actual nbr, it will work.
Dim cmd1
As OleDbCommand =
New OleDbCommand("Select nbrofcomments from table1 where PID = "
+ zsessvar1, myConn)
View 9 Replies
Dec 18, 2010
I have 13 checkbox which is consist of outlet locations, The way i store into database is converting the 13 outlet code and store in string type which is need to split it when the need to view it.
My problem now is, i would like get any releated outlet code checked into checkbox which is the outlet code store into mysql in same column and row. for example:
Outlet code store into my cLocCode column inside table itemdetail. The data inside store in string type:
|cLocCode |productcode |
|200,201,202,203,204,205 |xxxxxxxxxxxxxxxxxx |
As all of u can see the cLocCode store as string. I would like to load it into web form as checkbox which is like this:
x Checkbox200.Checked x Checkbox201.Checked x Checkbox202.Checked x Checkbox203.Checked
x Checkbox204.Checked x Checkbox205.Checked x Checkbox 206.Unchecked
this is the situation.
View 6 Replies
Feb 8, 2011
I am using following code on SelectedIndexChanged of Dropdownlist in GridView for filling txtCallCompletion.Text. When i am selecting first time it is coming correct and i am changing value of txtCallCompletion then i am selecting second checkbox then previous checked checkbox's txtCallCompletion value will be same as it is.
how to solve this issue in gridview checkbox i already checked.
[code]....
View 8 Replies
Jul 22, 2010
I have a label and a checkbox that reside in a datagrid. When the checkbox is checked (OnCheckedChanged), I would like to send the Checkbox value and the label.text to a method. I don't have a way of retrieving the values. I've seen a lot about retrieving all of the values from a datagrid, (myDataGrid.Items), but am not sure how to get the value for a specific row in the datagrid.
View 1 Replies
Jan 7, 2010
I have a datagrid setup where I have a column of checkboxes setup, several informational columns for the user, and a hidden ID column. I have set up the loop to check with checkboxes have been checked, but I am having troubles finding the ID of the row that has been checked. The following code results in a "Object reference not set to an instance of an object" error:
For Each row As GridViewRow In GridView1.Rows
Dim cb As CheckBox = row.FindControl("ParticipantSelector")
If cb IsNot Nothing AndAlso cb.Checked Then
Dim productID As Integer
productID = CType(row.FindControl("ID"), Label).Text
Response.Write("You have selected " & productID & "<br>")
End If
Next
I am sure that I don't have something right here.
View 8 Replies
Nov 16, 2010
I have a gridview that returns several records for the same user and each record has a column with a check box. I need to allow the user to choose only one to check. Also one check box is always supposed to be checked. What is the best way to do it? I was thinking of writing a stored procedure that checks if only one is checked, and then returns true or false. I think there is a more efficient way to do it...
View 3 Replies
May 19, 2010
I have a gridview with the following in the code behind file. Every once in a while when I open the page the totals in my grid footer are 3 times what they should be. Should I be doing something in this code that I'm not currently doing, in order to prevent this? The count of rows is always correct, but the sum of the amounts is where the issue is.
These are my variables that are at the top of the code behind file.
[code]....
View 4 Replies