Problem with passing a parameter to a method that is in another view page in MVC

Last post 10-22-2008 5:46 PM by TStamper. 0 replies.

Sort Posts:

  • Problem with passing a parameter to a method that is in another view page in MVC

    10-22-2008, 5:46 PM
    • Member
      6 point Member
    • TStamper
    • Member since 10-20-2008, 12:48 PM
    • Posts 59

    I am trying to use a popup calendar and on one view page"move.aspx" I have the image and textbox id:

     <asp:textbox id="txtFrom" runat="server" Columns="10" MaxLength="10" CssClass="smInput"></asp:textbox>

    <input id="Image2" type="image" name="Calendar" runat="server"

    onclick ="window.open('calendar?textbox=txtFrom','cal','width=150,height=150,left=170,top=180')" src="/Content/img/calendar.gif"/>

    and on a calendar.aspx view page and code behind I have :

    override protected void OnInit(EventArgs e)

    {

    InitializeComponent();base.OnInit(e);

    }

    private void InitializeComponent()

    {

    //nothing

    }

    #endregion

     

    protected void calendar_SelectionChanged(object sender, System.EventArgs e)

    {

    if (Request.QueryString["textbox"] != "")

    {

    string strScript = "<script>window.opener.document.forms(0)." + Request.QueryString["textbox"].ToString() + ".value = '";

    strScript += calendar1.SelectedDate.ToString("yyyy/MM/dd");

    string Date = calendar1.SelectedDate.ToString("yyyy/MM/dd");

    strScript += "';self.close()";strScript += "</" + "script>";

    ClientScript.RegisterClientScriptBlock(this.GetType(),"Calendar_ChangeDate", strScript);

    }

    <form id="Form1" method="post" runat="server" >

    <asp:Calendar id="calendar1" nSelectionChanged="Change_Date"

    runat="server" style="Z-INDEX: 101; LEFT: 8px;

    POSITION: absolute; TOP: 4px; font-size: 9pt;

    font-family: arial;"

    onselectionchanged="calendar_SelectionChanged"

    Height="1px" Width="1px">

    <DayHeaderStyle Font-Names="Verdana">

    </DayHeaderStyle>

    </asp:Calendar></form>

    and the code is slected the new date,but it is not populating the textbox in the move.aspx view , So I was trying to see if I can just pass the new Date value to a method in the "move" code behind to update the value so it can display, oppose to remaing blank, If there is a better approach please let me know.

Page 1 of 1 (1 items)