This is a migrated thread and some comments may be shown as answers.

Pass value via linkbutton

2 Answers 100 Views
Window
This is a migrated thread and some comments may be shown as answers.
Joe Riley
Top achievements
Rank 1
Joe Riley asked on 18 Apr 2012, 09:39 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 19 Apr 2012, 01:25 PM
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.
0
Joe Riley
Top achievements
Rank 1
answered on 19 Apr 2012, 01:43 PM
Thank you that worked great.
Tags
Window
Asked by
Joe Riley
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Joe Riley
Top achievements
Rank 1
Share this question
or