Click here to Skip to main content
15,918,003 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Filling in form fields Pin
Christian Graus5-May-09 12:25
protectorChristian Graus5-May-09 12:25 
GeneralRe: Filling in form fields Pin
redone6325-May-09 13:10
redone6325-May-09 13:10 
AnswerRe: Filling in form fields Pin
saanj5-May-09 19:23
saanj5-May-09 19:23 
QuestionCheckBoxList value lost on postback Pin
Swetha Sankaran5-May-09 9:44
Swetha Sankaran5-May-09 9:44 
AnswerRe: CheckBoxList value lost on postback Pin
Christian Graus5-May-09 12:13
protectorChristian Graus5-May-09 12:13 
GeneralRe: CheckBoxList value lost on postback Pin
Swetha Sankaran6-May-09 4:20
Swetha Sankaran6-May-09 4:20 
AnswerRe: CheckBoxList value lost on postback Pin
saanj5-May-09 19:25
saanj5-May-09 19:25 
AnswerRe: CheckBoxList value lost on postback Pin
Swetha Sankaran13-May-09 9:50
Swetha Sankaran13-May-09 9:50 
Finally i was able to resolve the issue. The way i accomplished this was to create a list with the selected CheckBoxList values and reselect the original check box list based on the values in the new list.

public ReadOnlyCollection<string> ParameterValues<br />
        {<br />
            get<br />
            {<br />
                //This method first checks the current value of the ChildControlsCreated property. <br />
                //If this value is false, the CreateChildControls method is called. <br />
                this.EnsureChildControls();<br />
<br />
                List<string> names = new List<string>();<br />
                if (!string.IsNullOrEmpty(cName))<br />
                {<br />
                    for (int i = 0; i < cBList.Items.Count; i++)<br />
                    {<br />
                        if (cBList.Items[i].Selected)<br />
                        {<br />
                            names.Add(cBList.Items[i].Value);<br />
                            selectedCBListItems.Add(cBList.Items[i]);<br />
                        }<br />
                    }<br />
<br />
                }<br />
                for (int i = 0; i < cBList.Items.Count; i++)<br />
                {<br />
                    ListItem item = cBList.Items[i];<br />
                    if (item.Value == cName.ToString())<br />
                    {<br />
                        cBList.SelectedIndex = i;<br />
                        item.Selected = true;<br />
                    }<br />
                }<br />
                ReadOnlyCollection<string> result = new ReadOnlyCollection<string>(names);<br />
                return result;<br />
            }<br />
        }<br />
<br />
  protected override void OnPreRender(EventArgs e)<br />
        {<br />
            base.OnPreRender(e);<br />
            if (this.Page.IsPostBack)<br />
            {<br />
                cBList.DataBind();<br />
                for (int i = 0; i < selectedCBListItems.Count; i++)<br />
                {<br />
                    if (cBList.Items[i].Value == selectedCBListItems[i].Value)<br />
                    {<br />
                        cBList.Items[i].Selected = true;<br />
                    }<br />
                }<br />
<br />
            } <br />
}<br />


I am sure there might be some other elegant solution. I am yet to implement it. Please shed light on this topic. If you had the same issue, and if nothing else works, try the above method Smile | :)
QuestionASP.NET Test Tool Question Pin
elapid5-May-09 9:14
elapid5-May-09 9:14 
QuestionLocal Server Problem(C# ASP DOT NET) Pin
mishigun5-May-09 8:34
mishigun5-May-09 8:34 
AnswerRe: Local Server Problem(C# ASP DOT NET) Pin
Yusuf5-May-09 9:07
Yusuf5-May-09 9:07 
GeneralRe: Local Server Problem(C# ASP DOT NET) Pin
mishigun5-May-09 9:26
mishigun5-May-09 9:26 
QuestionUrgent : Web and Windows Integration(Passing values from web to windows) Pin
mishigun5-May-09 8:27
mishigun5-May-09 8:27 
AnswerRe: Urgent : Web and Windows Integration(Passing values from web to windows) Pin
Yusuf5-May-09 9:11
Yusuf5-May-09 9:11 
QuestionLosing cookies Pin
yasBinder5-May-09 8:14
yasBinder5-May-09 8:14 
AnswerRe: Losing cookies Pin
Yusuf5-May-09 9:15
Yusuf5-May-09 9:15 
GeneralRe: Losing cookies Pin
yasBinder5-May-09 9:37
yasBinder5-May-09 9:37 
GeneralRe: Losing cookies Pin
yasBinder7-May-09 16:47
yasBinder7-May-09 16:47 
QuestionHelp on Socket Programming in ASP.NET Pin
RoopeshReddy5-May-09 7:52
RoopeshReddy5-May-09 7:52 
QuestionAnyone familiar with "Prompt for symbolic renaming when renaming files" in Visual Studio Pin
pzn3xq5-May-09 7:45
pzn3xq5-May-09 7:45 
QuestionIs it best to store the sln and suo file within the same directory as your website directory (cs, aspx)? Pin
pzn3xq5-May-09 7:20
pzn3xq5-May-09 7:20 
AnswerRe: Is it best to store the sln and suo file within the same directory as your website directory (cs, aspx)? Pin
Yusuf5-May-09 9:21
Yusuf5-May-09 9:21 
QuestionException Pin
adigatm5-May-09 7:13
adigatm5-May-09 7:13 
AnswerRe: Exception Pin
Yusuf5-May-09 9:24
Yusuf5-May-09 9:24 
AnswerRe: Exception Pin
Abhijit Jana5-May-09 19:41
professionalAbhijit Jana5-May-09 19:41 

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.