Pass value via linkbutton

3 posts, 1 answers
  1. Joe Riley
    Joe Riley avatar
    6 posts
    Member since:
    Mar 2010

    Posted 18 Apr 2012 Link to this post

    Current project requires that I pass a value that someone typed in via a RadDateInput textbox to the radWindow that will launch when a user clicks on the link button.  Maybe I am getting confused with the controls and would appreciate some direction.  Below is my code.
    <script type="text/javascript">
        //<![CDATA[
        function openRadWin() {
            radopen("ManageFS.aspx?cycle_date=" + radDateInput1, "RadWindow1");
        }
        //]]>                                                                       
    </script>
    When a user clicks btnAddStmt it will launch the radWindow and I would like to pass the value.  What I also would like to do is validate that _new_period is not blank otherwise there is no need to pop-up the window.  Can't seem to have it perform validation client-side and still have things work.
    <td style="text-align: center;">
        New statement cycle date <strong>(mm/dd/yyyy)</strong>:
             
        <telerik:RadDateInput ID="_new_period" runat="server" Width="100px"
            InvalidStyleDuration="100" CssClass="InputText" DateFormat="MM/dd/yyyy"
            DisplayDateFormat="MM/dd/yyyy">
        </telerik:RadDateInput>
    </td>
    <td style="text-align: center;" class="side">
        <asp:LinkButton ID="btnAddStmt" runat="server" Visible="false">Add Statement</asp:LinkButton>
    </td>
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
               If Session("site_member_type") = 1 Then
                    btnAddStmt.Visible = True
                    Me.btnAddStmt.Attributes.Add("onclick", "openRadWin(); return false;")
                    Me.pnlHideViews.Visible = True
                End If
    end sub
  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 19 Apr 2012 Link to this post

    Hello Joe,

    I have created a sample based on your scenario. Here is the code.
    aspx:
    <telerik:RadDateInput ID="_new_period" runat="server" Width="100px" InvalidStyleDuration="100" CssClass="InputText" DateFormat="MM/dd/yyyy" DisplayDateFormat="MM/dd/yyyy">
    </telerik:RadDateInput>
    <asp:LinkButton ID="btnAddStmt" runat="server" >Add Statement</asp:LinkButton>
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true">
     <Windows>
        <telerik:RadWindow ID="RadWindow1" runat="server">
        </telerik:RadWindow>
      </Windows>
    </telerik:RadWindowManager>
    C#:
    protected void Page_Load(object sender, EventArgs e)
    {
       btnAddStmt.Attributes.Add("onclick", "openRadWin(); return false;");
    }
    JS:
    <script type="text/javascript">
        function openRadWin() {
            debugger;
            var DateInput = $find("<%= _new_period.ClientID %>");
            var dt = DateInput.get_value();
            window.radopen("MangeFS.aspx?cycle_date="+dt, "RadWindow1");
        }
    </script>

    Thanks,
    Shinu.
  3. Joe Riley
    Joe Riley avatar
    6 posts
    Member since:
    Mar 2010

    Posted 19 Apr 2012 Link to this post

    Thank you that worked great.
Back to Top