How do I pass value open radwinow modal in asp.net

6 posts, 0 answers
  1. duminda
    duminda avatar
    4 posts
    Member since:
    Mar 2011

    Posted 03 Aug 2011 Link to this post

        Hi, 

     

    I am working on an ASP.Net Project. I am using Radwindowmanager to open a page on click on button.

    Can anyone tell me how to open a radwindow in showdialog() method

     

     

    public partial class WebForm2 : System.Web.UI.Page

     {

     

     

    protected void Button2_Click1(object sender, EventArgs e)

     

    {

     Telerik.Web.UI.

    RadWindow newWindow = new Telerik.Web.UI.RadWindow();

     newWindow.NavigateUrl = "SearchGrid.aspx";

     newWindow.OpenerElementID = Button2.ClientID;

     newWindow.VisibleOnPageLoad = true;

     newWindow.DestroyOnClose = true;

     newWindow.Modal = true;

     newWindow.EnableViewState = false;

     RadWindowManager1.Windows.Add(newWindow);

    }
    }

    In this scenario I need to pass dataset to searchdrid.aspx and need to get selected value from serachgrid.aspx to WebForm2.aspx textbox. In

    below I mention the sample which I did from c# windows app.
     

    private void  SearchGridTable(DataTable SearchGrid)

     {

     formSearchGrid frmSearch = new formSearchGrid();

     frmSearch.DataSource = SearchGrid;

     frmSearch.ShowDialog();

     return frmSearch.strVal;

     }

    pivate void rdbutSearchCategory_Click(object sender, EventArgs e)

     {

     try

     {

     CommonVariables commVariable = new CommonVariables();

      commVariable.Type = strRequesttype;

     DataTable serachDatatable = new CategoryService().SelectDetails(commVariable);

     rdtxtCatCode.Text = Utility.SearchGridTable(serachDatatable);

     }

     catch (Exception ex)

     {

     

     MessageBox.Show(ex.Message.ToString(), Constant.SystemMessageErrorHeader, MessageBoxButtons.OK, MessageBoxIcon.Error);

     }

    }

     
    please help

  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    4533 posts

    Posted 03 Aug 2011 Link to this post

    Hi Duminda,


    I am not sure I understand your scenario correctly, but if you need to pass values between pages you can do that in several ways:
    1) declare public properties in the pages and access them as you would with any other aspx page. How exactly you do this depends on your scenario and preferences, as this is a general ASP task. You could also use a session variable if you like.
    2) pass information via a querystring when you open the RadWindow. More information on the approach is available in this help article and you can see it in action in this online demo. Working with the querystrings is again up to the developer's custom logic.
    3) you could use JavaScript to work with the RadWindows, since they are client-side objects and this is the beast, easiest and most powerful way to use them. I believe the following list of articles will be helpful in passing values between them, accessing them and other general tasks:
    http://www.telerik.com/help/aspnet-ajax/window-programming-opening.html
    http://www.telerik.com/help/aspnet-ajax/window-programming-using-radwindow-as-dialog.html
    http://www.telerik.com/help/aspnet-ajax/window-programming-calling-functions.html
    http://www.telerik.com/help/aspnet-ajax/radwindow-troubleshooting-javascript-from-server-side.html
    Some examples that utilize this functionality can be seen in action in the following onilne demos:
    http://demos.telerik.com/aspnet-ajax/window/examples/dialogreturnvalue/defaultcs.aspx
    http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandwindow/defaultcs.aspx?product=window

    As for the way to open a RadWindow from the code-behind please examine the article I linked above: http://www.telerik.com/help/aspnet-ajax/radwindow-troubleshooting-javascript-from-server-side.html.

    I hope you find this information helpful and you will be able to advance in your project.

    Kind regards,
    Marin
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. duminda
    duminda avatar
    4 posts
    Member since:
    Mar 2011

    Posted 04 Aug 2011 Link to this post

    Hi Marin

    Thanks for your reply. Her with I attached some print screen which I done C#  windows application. Actually it is a search screen which I replace combo box in windows form. I need to do it in Web Application as well. Once you go through the print screen which I attached, hope you can easily understand my requirement

    Best Regards
    Duminda

  4. Marin Bratanov
    Admin
    Marin Bratanov avatar
    4533 posts

    Posted 04 Aug 2011 Link to this post

    Hi Duminda,

    What I can gather from the several screenshots is that you need to have a grid on the main page, open a RadWindow from this grid, rebind the grid in the RadWindow according to the row/item clicked from the main one and pass the selected value back to the main page.

    Please examine the articles I linked in my previous post, as they are related to passing values from a RadWindow. Once you are able to pass a value you can use AJAX to rebind an existing grid and show this value.

    I also think you may find the following help article has a lot of useful resources to start you with developing web applications with ASP.NET:
    http://www.telerik.com/help/aspnet-ajax/introduction-general-aspnetajax-info.html


    You can also examine the code we use in our online demos, as they are installed locally on your system when you install the RadControls for ASP.NET AJAX - the LiveDemos folder in your installation directory.

    The demos I believe you may find useful are as follows:
    http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandwindow/defaultcs.aspx?product=window

    http://demos.telerik.com/aspnet-ajax/window/examples/usingurlforserverarguments/defaultcs.aspx



    All the best,
    Marin
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  5. duminda
    duminda avatar
    4 posts
    Member since:
    Mar 2011

    Posted 09 Aug 2011 Link to this post

    Hi marin,
    I have tried somany ways but still I couldn't meet my requierment ,So Please help me
    protected void Button1_Click(object sender, EventArgs e)
            {
                Telerik.Web.UI.RadWindow newWindow = new Telerik.Web.UI.RadWindow();
                newWindow.NavigateUrl = "WebForm3.aspx";
                newWindow.OpenerElementID = Button2.ClientID;
                newWindow.VisibleOnPageLoad = true;
                newWindow.DestroyOnClose = true;
                newWindow.Modal = true;
                newWindow.EnableViewState = false;
                RadWindowManager1.Windows.Add(newWindow);
            }

    I can open radwindow using above coding . Please tell me how do i get return value from child form (radwindow) to parent form without using java script .
    can we use ClientCallBackFunction ?

    After getting the value from child form is there any way to call bellow method in parent form. It's predefine in the parent form.
    private void FillItemDetails(string strType)
           {
               try
               {
                   CommonVariables commVariable = new CommonVariables();
                   ItemMasterFileVariables itemVariable = new ItemMasterFileVariables();
                   commVariable.Type = strType;
                   itemVariable.CatCode = rdtxtCatCode.Text.ToString().Trim();
                   DataTable detialsDatatable = new MItemService().SelectItemForTicket(commVariable, itemVariable);
                   if (detialsDatatable.Rows.Count == 0)
                   {
                       //Utility.ClearForm(radGroupBox1);
                       Utility.CreateMessageAlert(this, err.GetErrorMessage("GERR013"), "key", this.GetType());
                       rdtxtItemCode.Focus();
                       return;
                   }
                   rdtxtItemName.Text = detialsDatatable.Rows[0][1].ToString();
                   rdtxtCatCode.Text = detialsDatatable.Rows[0][2].ToString();
                   rdtxtCatName.Text = detialsDatatable.Rows[0][3].ToString();
                   rdtxtTypeCode.Text = detialsDatatable.Rows[0][4].ToString();
                              }
               catch (Exception ex)
               {
                   throw ex;
               }
           }

    Thanks & Best Regards
    Duminda
  6. Marin Bratanov
    Admin
    Marin Bratanov avatar
    4533 posts

    Posted 10 Aug 2011 Link to this post

    Hi Duminda,

    The reason why I recommend JavaScript is because it is the easiest way to pass information between different pages. If you wish to do so in the code-behind there are different ways to do so, and actually none of them are related to our controls in any way. What I can suggest is that you start from the following google search and see which of the methods advised in the net best fits your needs:
    http://www.google.com/search?&q=call+method+from+another+page


    http://www.codeproject.com/KB/user-controls/Page_UserControl.aspx
    http://bytes.com/topic/c-sharp/answers/275312-how-call-function-another-page
    http://stackoverflow.com/questions/330138/why-cant-i-call-a-public-method-in-another-class




    Greetings,
    Marin
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top