Click here to Skip to main content
15,885,782 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a problem when i try to keep values of input textboxes after postback in .net.
i have try with vievstate and the requestform to get html input values. and i have try to use session but i can get it to work, and i have cant find anything i havent tryede on goggle he is my code.
XML
int idAddonR = 0;
            foreach (XmlNode nodeR in nodeListADDonR)
            {

                string udsolgtadd1 = nodeR["RoomStatus"].InnerText;
                int antal = 1;
                string inputr = "<input maxlength='3' size='3' style='text-align: center;outline: 0;border-radius:10px; box-shadow: 2px 2px 1px #888888; height: 26px;  width: 50px;' placeholder='&nbsp;Antal' name='txtRoomAntal" + idAddonR + "' id='txtRoomAntal" + idAddonR + "'" + "data-role='none' type='text'  runat='server'/>";


                antal = Convert.ToInt32(udsolgtadd1);


                if (antal == 0)
                {
                    inputr = "<input readonly='readonly' style='background-color:lightgrey;text-align: center;outline: 0;border-radius:10px; box-shadow: 2px 2px 1px #888888; height: 26px;  width: 50px;' placeholder='&nbsp;Antal' name='txtRoomAntal" + idAddonR + "' id='txtRoomAntal" + idAddonR + "'" + "data-role='none' type='text' />";
                    nodeR["RoomStatus"].InnerText = "<i style='color:red;'>Udsolgt<i>";
                }
                else if (antal <= 5)
                {
                    inputr = "<input maxlength='3' size='3' style='text-align: center;outline: 0;border-radius:10px; box-shadow: 2px 2px 1px #888888; height: 26px;  width: 50px;' placeholder='&nbsp;Antal' name='txtRoomAntal" + idAddonR + "' id='txtRoomAntal" + idAddonR + "'" + "data-role='none' type='text' />";

                    nodeR["RoomStatus"].InnerText = "<i style='color:green;'>Få pladser tilbage</i>";
                }
                else if (antal >= 5)
                {
                    nodeR["RoomStatus"].InnerText = "";
                }




                litResultat.Text += @"<table class='table-responsive'><tr>"
                  + "<td class='col-sm-1'>" + inputr + "</td>"
                  + "<td class='col-md-3' style='text-align:left;'>" + nodeR["RoomText"].InnerText + "</td>"
                  + "<td class='col-md-1' style='text-align:right;'>" + nodeR["RoomPrice"].InnerText + "&nbsp;kr</td>"
                  + "<td class='col-md-3' style='text-align:left;'>" + "<i style=' font-family: times, Times New Roman, times-roman, georgia, serif;font-size: 16px;line-height: 40px;letter-spacing: -1px;color: #444;margin: 0 0 0 0;padding: 0 0 0 0;font-weight: 500;'>" + nodeR["RoomPriceOffersText"].InnerText + nodeR["RoomPriceOffers"].InnerText + "</i></td>"
                  + "<td class='col-md-2' style='text-align:left;'>" + "<i style=' font-family: times, Times New Roman, times-roman, georgia, serif;font-size: 18px;line-height: 40px;letter-spacing: -1px;color: #444;margin: 0 0 0 0;padding: 0 0 0 0;font-weight: 500;'>" + nodeR["RoomStatus"].InnerText + "</i></td>"

                 + "</tr>"
                 + "</table>";

                idAddonR++;

            }
Posted
Comments
njammy 30-Jul-15 8:54am    
Please can you use the Improve Question option to add the method / event in which the code you posted is being called from?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900