Click here to Skip to main content
15,910,471 members
Home / Discussions / C#
   

C#

 
GeneralRe: Problems adding an .NET 3.5 dll to a .NET 2.0 application Pin
Stephen Holdorf5-Dec-14 9:13
Stephen Holdorf5-Dec-14 9:13 
GeneralRe: Problems adding an .NET 3.5 dll to a .NET 2.0 application Pin
OriginalGriff5-Dec-14 21:39
mveOriginalGriff5-Dec-14 21:39 
QuestionWindows Service Interface Pin
milo-xml5-Dec-14 3:45
professionalmilo-xml5-Dec-14 3:45 
GeneralRe: Windows Service Interface Pin
PIEBALDconsult5-Dec-14 3:54
mvePIEBALDconsult5-Dec-14 3:54 
GeneralRe: Windows Service Interface Pin
milo-xml8-Dec-14 2:12
professionalmilo-xml8-Dec-14 2:12 
Questiongeneral query related to C# Pin
Member 112872604-Dec-14 13:33
Member 112872604-Dec-14 13:33 
AnswerRe: general query related to C# Pin
syed shanu4-Dec-14 14:14
professionalsyed shanu4-Dec-14 14:14 
GeneralRe: general query related to C# Pin
Member 112872604-Dec-14 14:29
Member 112872604-Dec-14 14:29 
GeneralRe: general query related to C# Pin
syed shanu4-Dec-14 14:45
professionalsyed shanu4-Dec-14 14:45 
AnswerRe: general query related to C# Pin
BillWoodruff4-Dec-14 18:46
professionalBillWoodruff4-Dec-14 18:46 
AnswerRe: general query related to C# Pin
V.4-Dec-14 20:03
professionalV.4-Dec-14 20:03 
GeneralRe: general query related to C# Pin
den2k885-Dec-14 0:35
professionalden2k885-Dec-14 0:35 
GeneralRe: general query related to C# Pin
Member 112872605-Dec-14 2:44
Member 112872605-Dec-14 2:44 
GeneralRe: general query related to C# Pin
V.5-Dec-14 2:46
professionalV.5-Dec-14 2:46 
GeneralRe: general query related to C# Pin
Member 112872605-Dec-14 3:02
Member 112872605-Dec-14 3:02 
GeneralRe: general query related to C# Pin
Member 112872605-Dec-14 3:39
Member 112872605-Dec-14 3:39 
GeneralRe: general query related to C# Pin
V.5-Dec-14 4:36
professionalV.5-Dec-14 4:36 
QuestionQuestions about refactoring switch statement to Strategy Pattern in C# Pin
Member 97402194-Dec-14 11:48
Member 97402194-Dec-14 11:48 
AnswerRe: Questions about refactoring switch statement to Strategy Pattern in C# Pin
SledgeHammer014-Dec-14 12:24
SledgeHammer014-Dec-14 12:24 
GeneralRe: Questions about refactoring switch statement to Strategy Pattern in C# Pin
BillWoodruff4-Dec-14 18:36
professionalBillWoodruff4-Dec-14 18:36 
GeneralRe: Questions about refactoring switch statement to Strategy Pattern in C# Pin
Matt T Heffron5-Dec-14 6:51
professionalMatt T Heffron5-Dec-14 6:51 
Questionpostback issue with dynamically created datetimepicker Pin
Dhyanga4-Dec-14 4:58
Dhyanga4-Dec-14 4:58 
Hi,

I am using dynamic datetimepicker that the user can add to any number. But I am having postback problem. Once I submit it, the return page should have all the submitted values including those added dynamic datetimepicker. Right now when i submit and when the page returns, all other static controls with data are there but no dynamically added datetimepicker controls.

Below is the code I used to add datatimepicker dynamically using javascript:

C#
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>


<link rel="stylesheet" media="all" type="text/css" href="jquery-ui.css" />
<link rel="stylesheet" media="all" type="text/css" href="jquery-ui-timepicker-addon.css" />
<script type="text/javascript" src="jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="jquery-ui.min.js"></script>
<script type="text/javascript" src="jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript" src="jquery-ui-sliderAccess.js"></script>
<script type="text/javascript">
    $(function () {
      
         var counter = 1;
          jQuery("#<%= btnD1Add.ClientID %>").click(function (event) {
            event.preventDefault(); //this code is added to prevent the default submit functionality of the button

            jQuery("<li>").appendTo(".Date1More");
            jQuery("<label id='lblD1StartTime" + counter + "'>StartTime:</label><input type='text' id='txtD1StartTime"  +counter + "' name='txtStartTime1'/>").timepicker({
                hourGrid: 10,
                minuteGrid: 10,
                timeFormat: 'hh:mm tt'
            }).appendTo(".Date1More");
            
            counter++;
        });
    });
</script>
       <asp:Button ID="btnD1Add" runat="server" Text="Add more time slots" />
       

               <li>
                    <ul class="Date1More">
                                          
                </ul>
               </li>
</html>


Now how to use postback for these controls? I had tried to use following code in code but didn't work. I even tried it using !Ispostback() function under pageLoad but no effect.


C#
protected string[] txtStartTime1;
   protected void Page_Load(object sender, EventArgs e)
        {
            
           
            txtStartTime1 = Request.Form.GetValues("txtStartTime1");
        }
protected void Page_Init(object sender, EventArgs e)
        {
            try
            {
                if (txtStartTime1.Length > 0)
                {
                    TextBox txtStTime1 = new TextBox();
                    txtStTime1.ID = "txtD1StartTime";
                    txtStTime1.CssClass = "timepicker";
                    this.Controls.Add(txtStTime1);

                }
              
            }
            catch(Exception ex){}

        }


Please help..
Dhyanga


modified 4-Dec-14 11:06am.

SuggestionRe: postback issue with dynamically created datetimepicker using javascript Pin
Richard MacCutchan4-Dec-14 5:01
mveRichard MacCutchan4-Dec-14 5:01 
GeneralRe: postback issue with dynamically created datetimepicker using javascript Pin
Dhyanga4-Dec-14 8:04
Dhyanga4-Dec-14 8:04 
QuestionHow to find a particular embedded resource in an assembly? Pin
Sivaji15654-Dec-14 1:08
Sivaji15654-Dec-14 1:08 

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.