Click here to Skip to main content
15,907,906 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Good evening,

I have a form of consultation base, and it has a button that you click to open a modal with a small medical data grid.

The user will select a row and with that the form should be closed, taking the form of consultation the selected row of data from datagrid view,

Could someone please help me?
Posted
Updated 3-Nov-15 3:54am
v2
Comments
Sergey Alexandrovich Kryukov 2-Nov-15 16:47pm    
Sorry. Hardly, because this is not a question and because it's hard to understand what you are talking about.
—SA
Member 12107877 2-Nov-15 17:00pm    
I will try to explain more ...


I am new to ASP.NET development.

I am developing a system for clinics that will schedule Medical Appointments.

I have a screen that serves the user to schedule your medical appointment.

This tela..tenho a button when the user clicks, opens a screen (modal) containing a grid with the doctors so that the user can choose.

When the user selects a particular row of the datagridview, this screen (modal) should be closed, and the data of the selected line should be taken to the Medical Consultation screen.

Understood?
Sergey Alexandrovich Kryukov 2-Nov-15 19:59pm    
Better, but now, what prevents you from closing the form and showing another one?
Anyway, the design with changing forms is, by far, not the best. Perhaps the best is having only on form changing its content.
—SA
Member 12107877 2-Nov-15 20:20pm    
I do not know how to do, so I asked for help
George Jonsson 2-Nov-15 20:26pm    
Are you using Windows Forms and a DataGridView or ASP.Net with the GridView?

1 solution

The solution is to have single form with tabs, wizard (google .net wizard control) or progressing panels in which you lead the user from step to step without opening/closing new forms.

If you're opening dialog forms, this is the way you pass the data.

C#
Public Class MyDialog {
public property DataRowView DoctorToReturn {get;set;}

    protected void btnOK_Click(object sender, EventArgs e) {
    // you'll need casting here
    DoctorToReturn = dgvYourGrid.SelectedRow.DataBoundItem
    
    }
}
public class myForm

//this is the method for opening the dialog (in your case, button click handler)
void openDialog () {
    using (dlg = new myDialog()) {
        if (dlg.ShowDialog() == DialogResult.OK) {
            // use returned value
            doctorObject.Name = dlg.DoctorToReturn["name"];
            doctorObject.Office = dlg.DoctorToReturn["office"]; 
            // map whatever you need from returned object
        }
    }
}
 
Share this answer
 
Comments
Member 12107877 3-Nov-15 8:55am    
I do not get your example ....

I am developing in ASP.Net with GridView

I do not even know where to start ....

I tried to see some articles of ASP Modal ..
Sinisa Hajnal 3-Nov-15 9:53am    
DataGridView is winforms control. And your question doesn't have asp.net tag.

You can apply same logic, but you'll have to read the documentation on a) jQuery.ui.dialog or ajaxToolkit dialog depending on what you're using.

The logic is the same, after you return from the dialog, write the data somewhere...or better yet use accordion or tab control to have all parts on the same form.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900