Really Stuck on a Canlendar Control PLEASE HELP!!!

Discussion in 'ASP .Net Web Controls' started by Midway, Aug 31, 2006.

  1. Midway

    Midway Guest

    Hi guys,

    This is what I'm doing, have a calendar control that I'm invoking from an
    hyperlink. the calendar control has some javascript code that when I pick a
    date, the date gets transffered to a text control on the calling form, that
    is all work working fine.

    Now here's the chanllenge that I'm just really stuck. I want to get that
    date from the calendar control to a text box within a Detailsview control. I
    have been trying so many things but nothing seems to work.

    Please some ideas on how I can do this PLEASEEEE.

    Thanks so much.

    Manny
    Midway, Aug 31, 2006
    #1
    1. Advertising

  2. Midway

    Guest

    Can you post a little code or explain what you have tried so far?

    Brennan Stehling
    http://brennan.offwhite.net/blog/

    Midway wrote:
    > Hi guys,
    >
    > This is what I'm doing, have a calendar control that I'm invoking from an
    > hyperlink. the calendar control has some javascript code that when I pick a
    > date, the date gets transffered to a text control on the calling form, that
    > is all work working fine.
    >
    > Now here's the chanllenge that I'm just really stuck. I want to get that
    > date from the calendar control to a text box within a Detailsview control. I
    > have been trying so many things but nothing seems to work.
    >
    > Please some ideas on how I can do this PLEASEEEE.
    >
    > Thanks so much.
    >
    > Manny
    , Aug 31, 2006
    #2
    1. Advertising

  3. Midway

    Midway Guest

    The Hyperlink that is invoking the Calendar control is;
    javascript:calendar_window=window.open('calendar.aspx?formname=NewEmployeeform.TextBox4','calendar_window', 'width=350,height=290');calendar_window.focus()

    The TextBox4 is a control outside the detailsview. what I was trying was to
    get that date to this TextBox4 control and pass that date to the TextBox
    within the Detailsview, I was able to do that but I need a post back to the
    server so the date shows up in the TextBox control within the Detailsview,
    but in order to get a post back to the server I need to clink on a button,
    that is not gonna work on the user interface.

    User should be able to just to click on that date and date should be
    inserted with the Date field in the details view no more actions done.


    Thanks for your help.

    Manny


    "" wrote:

    > Can you post a little code or explain what you have tried so far?
    >
    > Brennan Stehling
    > http://brennan.offwhite.net/blog/
    >
    > Midway wrote:
    > > Hi guys,
    > >
    > > This is what I'm doing, have a calendar control that I'm invoking from an
    > > hyperlink. the calendar control has some javascript code that when I pick a
    > > date, the date gets transffered to a text control on the calling form, that
    > > is all work working fine.
    > >
    > > Now here's the chanllenge that I'm just really stuck. I want to get that
    > > date from the calendar control to a text box within a Detailsview control. I
    > > have been trying so many things but nothing seems to work.
    > >
    > > Please some ideas on how I can do this PLEASEEEE.
    > >
    > > Thanks so much.
    > >
    > > Manny

    >
    >
    Midway, Aug 31, 2006
    #3
  4. Midway

    Guest

    I have posted an example here...

    http://brennan.offwhite.net/jsparent/

    That will open a child window which allows you to set a value in a
    textbox and then send that back to the parent. In your situation you
    need a place in the parent where you can set that value. If you have a
    hidden field (input of type hidden) you can target it if you know the
    ID. And if you are using an ASP.NET control you will need to figure
    out that ID since the ClientID is what is actually used in the HTML.

    You could just shorten the ClientID.

    http://blog.danbartels.com/archive/2005/11/11/1110.aspx

    What I have done to always know the value of the ClientID is to call
    RegisterScriptBlock with Javascript created to set to the value of the
    ClientID which can then be used in a static Javascript function.

    In my example you can use much of the code without making changes. The
    Javascript/DOM code should look very similar for your solution.

    Brennan Stehling
    http://brennan.offwhite.net/blog/

    Midway wrote:
    > The Hyperlink that is invoking the Calendar control is;
    > javascript:calendar_window=window.open('calendar.aspx?formname=NewEmployeeform.TextBox4','calendar_window', 'width=350,height=290');calendar_window.focus()
    >
    > The TextBox4 is a control outside the detailsview. what I was trying was to
    > get that date to this TextBox4 control and pass that date to the TextBox
    > within the Detailsview, I was able to do that but I need a post back to the
    > server so the date shows up in the TextBox control within the Detailsview,
    > but in order to get a post back to the server I need to clink on a button,
    > that is not gonna work on the user interface.
    >
    > User should be able to just to click on that date and date should be
    > inserted with the Date field in the details view no more actions done.
    >
    >
    > Thanks for your help.
    >
    > Manny
    >
    >
    > "" wrote:
    >
    > > Can you post a little code or explain what you have tried so far?
    > >
    > > Brennan Stehling
    > > http://brennan.offwhite.net/blog/
    > >
    > > Midway wrote:
    > > > Hi guys,
    > > >
    > > > This is what I'm doing, have a calendar control that I'm invoking from an
    > > > hyperlink. the calendar control has some javascript code that when I pick a
    > > > date, the date gets transffered to a text control on the calling form, that
    > > > is all work working fine.
    > > >
    > > > Now here's the chanllenge that I'm just really stuck. I want to get that
    > > > date from the calendar control to a text box within a Detailsview control. I
    > > > have been trying so many things but nothing seems to work.
    > > >
    > > > Please some ideas on how I can do this PLEASEEEE.
    > > >
    > > > Thanks so much.
    > > >
    > > > Manny

    > >
    > >
    , Sep 1, 2006
    #4
  5. Midway

    Midway Guest

    Hey Thanks very much for your reply. if it's not too much to ask, how would
    translate this code into VB? sorry I'm not that good with C#, I'm learning
    though, but if you could do this would be ownsome.

    Thanks very much.


    "" wrote:

    > I have posted an example here...
    >
    > http://brennan.offwhite.net/jsparent/
    >
    > That will open a child window which allows you to set a value in a
    > textbox and then send that back to the parent. In your situation you
    > need a place in the parent where you can set that value. If you have a
    > hidden field (input of type hidden) you can target it if you know the
    > ID. And if you are using an ASP.NET control you will need to figure
    > out that ID since the ClientID is what is actually used in the HTML.
    >
    > You could just shorten the ClientID.
    >
    > http://blog.danbartels.com/archive/2005/11/11/1110.aspx
    >
    > What I have done to always know the value of the ClientID is to call
    > RegisterScriptBlock with Javascript created to set to the value of the
    > ClientID which can then be used in a static Javascript function.
    >
    > In my example you can use much of the code without making changes. The
    > Javascript/DOM code should look very similar for your solution.
    >
    > Brennan Stehling
    > http://brennan.offwhite.net/blog/
    >
    > Midway wrote:
    > > The Hyperlink that is invoking the Calendar control is;
    > > javascript:calendar_window=window.open('calendar.aspx?formname=NewEmployeeform.TextBox4','calendar_window', 'width=350,height=290');calendar_window.focus()
    > >
    > > The TextBox4 is a control outside the detailsview. what I was trying was to
    > > get that date to this TextBox4 control and pass that date to the TextBox
    > > within the Detailsview, I was able to do that but I need a post back to the
    > > server so the date shows up in the TextBox control within the Detailsview,
    > > but in order to get a post back to the server I need to clink on a button,
    > > that is not gonna work on the user interface.
    > >
    > > User should be able to just to click on that date and date should be
    > > inserted with the Date field in the details view no more actions done.
    > >
    > >
    > > Thanks for your help.
    > >
    > > Manny
    > >
    > >
    > > "" wrote:
    > >
    > > > Can you post a little code or explain what you have tried so far?
    > > >
    > > > Brennan Stehling
    > > > http://brennan.offwhite.net/blog/
    > > >
    > > > Midway wrote:
    > > > > Hi guys,
    > > > >
    > > > > This is what I'm doing, have a calendar control that I'm invoking from an
    > > > > hyperlink. the calendar control has some javascript code that when I pick a
    > > > > date, the date gets transffered to a text control on the calling form, that
    > > > > is all work working fine.
    > > > >
    > > > > Now here's the chanllenge that I'm just really stuck. I want to get that
    > > > > date from the calendar control to a text box within a Detailsview control. I
    > > > > have been trying so many things but nothing seems to work.
    > > > >
    > > > > Please some ideas on how I can do this PLEASEEEE.
    > > > >
    > > > > Thanks so much.
    > > > >
    > > > > Manny
    > > >
    > > >

    >
    >
    Midway, Sep 1, 2006
    #5
  6. Midway

    Midway Guest

    Sorry about the last post about the VB code. What I ws trying to ask is; how
    do I find out the ID of the textbox that I want the value to come down from
    the child?

    "" wrote:

    > I have posted an example here...
    >
    > http://brennan.offwhite.net/jsparent/
    >
    > That will open a child window which allows you to set a value in a
    > textbox and then send that back to the parent. In your situation you
    > need a place in the parent where you can set that value. If you have a
    > hidden field (input of type hidden) you can target it if you know the
    > ID. And if you are using an ASP.NET control you will need to figure
    > out that ID since the ClientID is what is actually used in the HTML.
    >
    > You could just shorten the ClientID.
    >
    > http://blog.danbartels.com/archive/2005/11/11/1110.aspx
    >
    > What I have done to always know the value of the ClientID is to call
    > RegisterScriptBlock with Javascript created to set to the value of the
    > ClientID which can then be used in a static Javascript function.
    >
    > In my example you can use much of the code without making changes. The
    > Javascript/DOM code should look very similar for your solution.
    >
    > Brennan Stehling
    > http://brennan.offwhite.net/blog/
    >
    > Midway wrote:
    > > The Hyperlink that is invoking the Calendar control is;
    > > javascript:calendar_window=window.open('calendar.aspx?formname=NewEmployeeform.TextBox4','calendar_window', 'width=350,height=290');calendar_window.focus()
    > >
    > > The TextBox4 is a control outside the detailsview. what I was trying was to
    > > get that date to this TextBox4 control and pass that date to the TextBox
    > > within the Detailsview, I was able to do that but I need a post back to the
    > > server so the date shows up in the TextBox control within the Detailsview,
    > > but in order to get a post back to the server I need to clink on a button,
    > > that is not gonna work on the user interface.
    > >
    > > User should be able to just to click on that date and date should be
    > > inserted with the Date field in the details view no more actions done.
    > >
    > >
    > > Thanks for your help.
    > >
    > > Manny
    > >
    > >
    > > "" wrote:
    > >
    > > > Can you post a little code or explain what you have tried so far?
    > > >
    > > > Brennan Stehling
    > > > http://brennan.offwhite.net/blog/
    > > >
    > > > Midway wrote:
    > > > > Hi guys,
    > > > >
    > > > > This is what I'm doing, have a calendar control that I'm invoking from an
    > > > > hyperlink. the calendar control has some javascript code that when I pick a
    > > > > date, the date gets transffered to a text control on the calling form, that
    > > > > is all work working fine.
    > > > >
    > > > > Now here's the chanllenge that I'm just really stuck. I want to get that
    > > > > date from the calendar control to a text box within a Detailsview control. I
    > > > > have been trying so many things but nothing seems to work.
    > > > >
    > > > > Please some ideas on how I can do this PLEASEEEE.
    > > > >
    > > > > Thanks so much.
    > > > >
    > > > > Manny
    > > >
    > > >

    >
    >
    Midway, Sep 1, 2006
    #6
  7. Midway

    Guest

    Download Lutz Roeder's Reflector. It is a .NET utility which allows you
    to load .NET assemblies and browse them. When you double-click on a
    class or method it can actually show you the code. You can display the
    code as any .NET supported language. Then you can take that C# code,
    compile it, load the assembly and view it as VB.NET. :)

    I do both VB.NET and C#, but sometimes I come across some syntax I am
    not sure how to translate so I use this technique.

    To get the ID value for the Javascript, I place this in my web page as
    static Javascript.

    <script type="text/javascript">

    var controlClientId;

    function setControlClientId(newId) {
    controlClientId = newId;
    }

    // use controlClientId in your Javascript

    </script>

    Then build your string for Javascript in the code-behind and add it to
    the page.

    Dim scriptString as String = "<script type='text/javascript'>" + vbCrLf
    + _
    " setControlClientId(" + control.ClientID + ");" + vbCrLf + _
    "</script>" + vbCrLf

    I am not looking at working code as I write this so my syntax may be
    off and you may want to use a different property than ClientID but I
    think that is correct.

    To add Javascript to the page from a code-behind class, use the
    RegisterClientScriptBlock method. It has been updated in ASP.NET 2.0.

    ASP.NET 2.0
    http://msdn.microsoft.com/library/d...UIPageClassRegisterClientScriptBlockTopic.asp

    ASP.NET 1.1
    http://msdn.microsoft.com/library/d...UIPageClassRegisterClientScriptBlockTopic.asp

    Those pages should have some decent code for you to follow.

    Brennan Stehling
    http://brennan.offwhite.net/blog/


    Midway wrote:
    > Sorry about the last post about the VB code. What I ws trying to ask is; how
    > do I find out the ID of the textbox that I want the value to come down from
    > the child?
    >
    > "" wrote:
    >
    > > I have posted an example here...
    > >
    > > http://brennan.offwhite.net/jsparent/
    > >
    > > That will open a child window which allows you to set a value in a
    > > textbox and then send that back to the parent. In your situation you
    > > need a place in the parent where you can set that value. If you have a
    > > hidden field (input of type hidden) you can target it if you know the
    > > ID. And if you are using an ASP.NET control you will need to figure
    > > out that ID since the ClientID is what is actually used in the HTML.
    > >
    > > You could just shorten the ClientID.
    > >
    > > http://blog.danbartels.com/archive/2005/11/11/1110.aspx
    > >
    > > What I have done to always know the value of the ClientID is to call
    > > RegisterScriptBlock with Javascript created to set to the value of the
    > > ClientID which can then be used in a static Javascript function.
    > >
    > > In my example you can use much of the code without making changes. The
    > > Javascript/DOM code should look very similar for your solution.
    > >
    > > Brennan Stehling
    > > http://brennan.offwhite.net/blog/
    > >
    > > Midway wrote:
    > > > The Hyperlink that is invoking the Calendar control is;
    > > > javascript:calendar_window=window.open('calendar.aspx?formname=NewEmployeeform.TextBox4','calendar_window', 'width=350,height=290');calendar_window.focus()
    > > >
    > > > The TextBox4 is a control outside the detailsview. what I was trying was to
    > > > get that date to this TextBox4 control and pass that date to the TextBox
    > > > within the Detailsview, I was able to do that but I need a post back to the
    > > > server so the date shows up in the TextBox control within the Detailsview,
    > > > but in order to get a post back to the server I need to clink on a button,
    > > > that is not gonna work on the user interface.
    > > >
    > > > User should be able to just to click on that date and date should be
    > > > inserted with the Date field in the details view no more actions done.
    > > >
    > > >
    > > > Thanks for your help.
    > > >
    > > > Manny
    > > >
    > > >
    > > > "" wrote:
    > > >
    > > > > Can you post a little code or explain what you have tried so far?
    > > > >
    > > > > Brennan Stehling
    > > > > http://brennan.offwhite.net/blog/
    > > > >
    > > > > Midway wrote:
    > > > > > Hi guys,
    > > > > >
    > > > > > This is what I'm doing, have a calendar control that I'm invoking from an
    > > > > > hyperlink. the calendar control has some javascript code that when I pick a
    > > > > > date, the date gets transffered to a text control on the calling form, that
    > > > > > is all work working fine.
    > > > > >
    > > > > > Now here's the chanllenge that I'm just really stuck. I want to get that
    > > > > > date from the calendar control to a text box within a Detailsview control. I
    > > > > > have been trying so many things but nothing seems to work.
    > > > > >
    > > > > > Please some ideas on how I can do this PLEASEEEE.
    > > > > >
    > > > > > Thanks so much.
    > > > > >
    > > > > > Manny
    > > > >
    > > > >

    > >
    > >
    , Sep 1, 2006
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tom
    Replies:
    7
    Views:
    5,964
    Luiz Vianna
    Nov 13, 2003
  2. Darrel
    Replies:
    4
    Views:
    402
    Darrel
    Oct 23, 2004
  3. Steve
    Replies:
    0
    Views:
    442
    Steve
    Mar 2, 2006
  4. Replies:
    30
    Views:
    978
    Arne Vajhøj
    Feb 10, 2008
  5. mazdotnet
    Replies:
    1
    Views:
    302
    bruce barker
    Jul 28, 2008
Loading...

Share This Page