Click here to Skip to main content
15,888,816 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questionurgent ! ASP.net dropdownlist Pin
cheeken2u7-May-06 4:26
cheeken2u7-May-06 4:26 
AnswerRe: urgent ! ASP.net dropdownlist Pin
Tirthadip7-May-06 21:33
Tirthadip7-May-06 21:33 
AnswerRe: urgent ! ASP.net dropdownlist Pin
Tirthadip7-May-06 22:10
Tirthadip7-May-06 22:10 
GeneralRe: urgent ! ASP.net dropdownlist Pin
cheeken2u8-May-06 6:40
cheeken2u8-May-06 6:40 
Questionasp.net to mysql 4.1 with utf-8 encoding Pin
mohammad kazem sattari7-May-06 1:37
mohammad kazem sattari7-May-06 1:37 
QuestionCrystal Report In Asp.Net Pin
a59ir6-May-06 23:57
a59ir6-May-06 23:57 
Questioninserting data without prebuilt forms? Pin
username1996-May-06 22:28
username1996-May-06 22:28 
QuestionStrange behavior of RadioButtonList inside a Repeater Pin
Raul Davila6-May-06 18:39
Raul Davila6-May-06 18:39 
Hi,

I made a Web User Control "QuestionUserControl" that contains a RadioButtonList and a TextBox. On my web form I use that control inside a Repeater.

<br />
 <asp:REPEATER id="QuestionRepeater" runat="server"><br />
  <ITEMTEMPLATE><br />
   <UC1:QUESTIONUSERCONTROL id="quc" runat="server"></UC1:QUESTIONUSERCONTROL><br />
  </ITEMTEMPLATE><br />
 </asp:REPEATER><br />


The repeater is then bound to a data source that contains records in the following format: QuestionId INT, QuestionType BYTE (1 = choice, 2 = text)

On the Repeater's DataBound event I call a public method of the QuestionUserControl passing the DataRow that contains QuestionId and QuestionType.

<br />
private void QuestionRepeater_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)<br />
{<br />
 if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)<br />
  ( (Cuestionario.QuestionUserControl)e.Item.FindControl("quc") ).ContructQuestion((DataRowView)e.Item.DataItem, this.m_Language);<br />
}<br />


The Public Method in the QuestionUserControl then shows or hides the RadioButtonList or the TextBox depending on the QuestionType. If QuestionType was "choices" the QuestionUserControl then uses QuestionId to retreive a list of choices from the database and binds that to the RadioButtonList.

After the user posts back I gather the values from the multiple QuestionUserControls created by the repeater in the QuestionUserControl_UnLoad event.

Now the problem.

I can gather all the values posted except for the very first RadioButtonList that gets created. Example:

Repeater's Datasource:

The repeater creates 5 QuestionUserControls.
QuestionId QuestionType
1          1
2          1
3          2
4          1
5          2


This creates 5 QuestionUserControls.
The QuestionUserControls that receive a QuestionType == 1, retreive a list of choices and binds them to the RadioButtonList and hide the TextBox.
The QuestionUserControls that receive a QuestionType == 2, simply hide the RadioButtonList and shows the TextBox.

When the user submits the form, the QuestionUserControl_UnLoad event gets fired 5 times, one for each QuestionUserControl created by the repeater. Inside each QuestionUserControl_UnLoad event I have access to the RadioButtonList and the TextBox contained on that particular QuestionUserControl created by the repeater, so I can gather the values of each QuestionUserControl separately.

Once again, inside each QuestionUserControl_UnLoad I can get the values w/o a problem except for the very first QuestionUserControl that has a RadioButtonList.

I changed the order of the questions to put a QuestionUserControl that gets QuestionType == 2 (text) at the top and it had no problems. So it really doesn't matter the order of the QuestionUserControls that the Repeater creates.

The very first QuestionUserControl that contains a RadioButtonList acts as if the RadioButtonList has just been initialized with properties like:
<br />
SelectedIndex = -1<br />
SelectedValue = ""<br />


Sorry for such a long post. I just wanted to make sure you have all the info to help me. This is really driving me crazy Confused | :confused: .

TIA
QuestionCrystal Reports in .NET Pin
NinaWilliam6-May-06 18:05
NinaWilliam6-May-06 18:05 
AnswerRe: Crystal Reports in .NET Pin
Ista6-May-06 18:21
Ista6-May-06 18:21 
GeneralRe: Crystal Reports in .NET Pin
NinaWilliam8-May-06 22:47
NinaWilliam8-May-06 22:47 
GeneralRe: Crystal Reports in .NET Pin
Ista9-May-06 5:28
Ista9-May-06 5:28 
GeneralRe: Crystal Reports in .NET Pin
NinaWilliam14-May-06 21:39
NinaWilliam14-May-06 21:39 
GeneralRe: Crystal Reports in .NET Pin
Ista16-May-06 3:28
Ista16-May-06 3:28 
QuestionProblem with aspx pages Pin
Pet Lizard6-May-06 15:27
Pet Lizard6-May-06 15:27 
AnswerRe: Problem with aspx pages Pin
Guffa7-May-06 5:38
Guffa7-May-06 5:38 
GeneralRe: Problem with aspx pages Pin
Pet Lizard7-May-06 6:59
Pet Lizard7-May-06 6:59 
GeneralRe: Problem with aspx pages Pin
RichardGrimmer8-May-06 7:26
RichardGrimmer8-May-06 7:26 
Questionhow to make a popup window Pin
Isaac_cm6-May-06 12:30
Isaac_cm6-May-06 12:30 
AnswerRe: how to make a popup window Pin
enjoycrack6-May-06 14:33
enjoycrack6-May-06 14:33 
GeneralRe: how to make a popup window Pin
Isaac_cm7-May-06 2:34
Isaac_cm7-May-06 2:34 
GeneralRe: how to make a popup window Pin
enjoycrack7-May-06 5:13
enjoycrack7-May-06 5:13 
AnswerRe: how to make a popup window Pin
a59ir6-May-06 23:59
a59ir6-May-06 23:59 
GeneralRe: how to make a popup window Pin
Isaac_cm7-May-06 2:36
Isaac_cm7-May-06 2:36 
QuestionCSS files Pin
gauravkanwar6-May-06 9:33
gauravkanwar6-May-06 9:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.