We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Pass value from Component in DialogTemplate to DialogButton

Hello,

I am using a  SfDialog in a Component. Inside the Content of SfDialog   is another  Componen

1) VolumeStationErrorCodesList..-> This is a Grid ..On the header of this grid  are checkboxes.. I  want to pass the values selected in this Grid to DialogButton Export  defined in the SfDialog

  <SfDialog Width="1100px" Height="700px" ShowCloseIcon="true" @bind-Visible="WindowVisible" AllowPrerender=true IsModal=true>

    <DialogTemplates>

        <Header>@Title</Header>

        <Content>

            <div class="content-bordered">

       

        <VolumeStationErrorCodesList @ref="VolumeStationErrorCodesList" Job_Id=@Convert.ToInt32(JobId) Data_Type=2 StationId = "@Station_Id"></VolumeStationErrorCodesList>

        </div>

        </Content>

    </DialogTemplates>

    <DialogButtons>

         <DialogButton Content="Export" IsPrimary="true" OnClick="@ExportClick" />

        <DialogButton Content="Close" CssClass="e-danger tmas-btn-danger" IconCss="e-icons e-close" OnClick="@SummaryReportCloseClick" />

    </DialogButtons>

</SfDialog>

Question is , how do I pass value of the checkboxes defined in the grid in the component (VolumeStationErrorCodesList) out side to the Dialog Button Export OnClick @ExportClic

Please see Screen shot.

Thanks

Kapil 


This field must contain m

Attachment: Export_25345ffc.zip

3 Replies

MS Monisha Saravanan Syncfusion Team March 28, 2023 11:07 AM UTC


Hi Kapil,


Greetings from Syncfusion support.


We would like to inform in DataGrid we have inbuilt method which returns list of SelectedRecords. You can use this method to get the selected records details. Kindly check the below attached sample and code snippet for your reference.


https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_GetSelectedRecordsAsync


 

<SfButton @onclick="click">GetSelectedRecords</SfButton>

 

<SfGrid DataSource="@Orders" AllowGrouping="true" AllowResizing="true" AllowSorting="true" @ref="Grid" AllowPaging="true" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update" })" Height="315">

    <GridColumns>

  ...

   </GridColumns>

</SfGrid>

 

@code {

    public List<Order> Orders { get; set; }

    public SfGrid<Order> Grid { get; set; }

    public async Task click()

    {

        var a = await Grid.GetSelectedRecordsAsync();

    }



Please let us know if you have any concerns.


Regards,

Monisha



KS Kapil Shah March 29, 2023 11:58 AM UTC

This is not what I am looking for .

Please see screen shot. In the screen you will see that the header has checkboxes. I want to only export those rows which are checked.

Please review my first post

1) VolumeStationErrorCodesList..-> This is a Grid ..On the header of this grid  are checkboxes.. I  want to pass the values selected in this Grid to DialogButton Export  defined in the SfDialog


You solution does not say anything about the checkbox

Thanks

Kapil 


Attachment: Multiple_Grids_with_Check_box_6f4cc0ee.zip


PS Prathap Senthil Syncfusion Team April 4, 2023 01:20 PM UTC

Thanks for the update,

We understand that you are trying to pass the values selected in a Grid to a Dialog Button Export that is defined in the SfDialog. To achieve this requirement, we recommend using the GetSelectedRecordsAsync() method. This method returns a list of selected records based on the checkbox selection in the Grid. This should help you to pass the selected values to the Dialog Button Export. If you continue to face any difficulties, please feel free to share a simple issue reproducible sample and provide more details about your exact requirement.


Loader.
Up arrow icon