Use controls correctly - meaning postback my page on every text change??? Are you serious? And no, I'm not using Ajax... don't wanna go into details of why. 100s textboxes - my bad - that's a typo - 10s textboxes... It's a questionnaire, each question has a prepopulated text box against it. Thanks anyway :-)
SmartSpider
Posts
-
Reading javascript modified value from a readOnly TextBox [modified] -
Reading javascript modified value from a readOnly TextBox [modified]The page that I am working on displays a set of readonly text boxes with databound values. The user may enter edit mode [achieved through javascript: TxtBox.removeAttribute("readOnly")], modify the value, then exit edit mode [again javascript: TxtBox.setAttribute("readOnly", "true")]. Now when this form is posted back, I want to read the modified value of the text boxes, but all I get is the original values. One possible way for me to do this is put an input type="hidden" corresponding to each texbox being displayed and then, set it's value when the user exits the edit mode of the textbox. This way, when the page is posted back, I can read the value of these hidden fields, instead of actual textboxes. But I don't think this is the right way - unnecessarily increasing the page size, because at times, there could be 100s of textboxes. Is there another workaround? I am sure this is a common problem - I found many post, but no real solution. Any help is greatly appreciated. Thanks, R
modified on Saturday, January 24, 2009 4:28 PM
-
ASP.NET - Create a questionnaire/test on the fly.Aha! The Container.Parent - thanks a lot Paul. I did find a workaround, but this is definitely looks sleeker. My workaround: In the ItemDataBound of parent lv, where I bind the child lv's data, I modified my SQL - I now first retrieve the category name using:
string catgName = ((System.Data.DataRowView)((ListViewDataItem)e.Item).DataItem)["quesCatgName"].ToString();
Then set my SQL to:
sqlStr = "SELECT quesId, quesText, quesHint, '" + catgName + "' as quesCatgName FROM....."
This way, the category is available as 'quesCatgName' in the child lv - dunno if this causes a greater overhead - I will modify my code to use the approach you sent. Thanks, ~R
-
ASP.NET - Create a questionnaire/test on the fly.Hi Paul, I would have posted this as a separate question, but then I would have needed to explain what I am doing and how I am binding the nested ListViews... so I thought I'd try sending my question to you and hope for an answer. So I have nested ListViews - the parent displays the categories, and in the ItemTemplate of this parent, I have another ListView that displays the questions under that category - now is there a way for me to get the category name bound to parent listview, in the child listview? I can achieve this by modifying my SQL and populate the data source of the child lv with category name as well, but I don't think that's the right way (unecessarily retrieving the category name again, when, it is already available). Note - the category name is not available in any control of parent lv - it is just displayed using <%#Eval%> within a Appreciate your help - hope I am not pushing it. ~R
-
ASP.NET - Create a questionnaire/test on the fly.Paul, Cannot thank you enough... but Thanks! ~R
-
ASP.NET - Create a questionnaire/test on the fly.I was unable to download the sample from the link you pointed me to, but I read a little about ListView control at another website and so far it looks promising. In the sample I read, they had used and asp:AccessDataSource in the aspx file itself and simply pointed to the mdb file with a SELECT query. In my case, I need to select categories from table 1, loop over categories and select questions for each. Not sure how to do this... Paul - please know, your help and time are much appreciated :) Many thanks, ~R
-
ASP.NET - Create a questionnaire/test on the fly.Paul, Appreciate your response - it reinforces the fact that I am a newbie (but I'll get there) :-). I am going to read in detail on the ListView to see how and if I can use it in my case. I need to present a beautiful looking form, with (dynamic number of) categories, each having (dynamic number of) questions and each question needs to have an appropriate (let's say its only text box for now) control against it. And yes, on postback, I need to go through each answer and save it in a DB. The form needs to look beautiful and organized in catgories with a layout something like ------------- Category One | ------------- --> Question 1. In context of gravitational force, what is the difference between 'g' and 'G'? Answer 1. [Text Box] --> Question 2. What is the formula for the gravitational pull between two bodies of mass M1 & M2 that are x distance apart? --> Answer 2. [Text Box] ------------- Category Two | ------------- --> Question 1. In context of gravitational force, what is the difference between 'g' and 'G'? Answer 1. [Text Box] --> Question 2. What is the formula for the gravitational pull between two bodies of mass M1 & M2 that are x distance apart? --> Answer 2. [Text Box] Will the ListView allow for the tables (that's how I am grouping categories and ques within), images, etc? Thanks,
-
ASP.NET - Create a questionnaire/test on the fly.Hello Everyone, I am a newbie to the world of ASP.NET and I am trying to create a web based questionnaire/test. The user clicks on a link to start the test and the page that presents itself has questions and appropriate input control (text box or checkboxes, etc) for the user to answer. Based on the type of test that user selects, I have to present the form which gets questions from a database and it can be any number of questions. I do not know a good way to generate all the required text boxes dynamically, because, I have an aspx file, which just has the page skeleton (header and all) but the remaining content has to be set by the cs file for the form. I have found a way of doing this, but am not sure if (I don't think this is) this is the right way - in my cs file, I create the entire html form using StringBuilder and then set the innerHTML of a div in my aspx. I don't even know if this will work whent he user completes the test and submits it (haven't gotten that far yet) - i.e. I do not know if I'd be able to retrieve the values from text boxes, which are named like txtAnsToQues1, txtAnsToQues2, etc. Any help or a right direction is appreciated. (I did search the forum first and came up with some dynamic form results, but none answered what I am looking for - perhaps this is too basic?) Thanks, ~R