Click here to Skip to main content
15,881,089 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a web service and I have two textboxes and a button. I want to read data from web service.When I push the button I use a grid view to reach this aim. Is there another way to get data from web service that I can eliminate the gridview?

Here is my code:

protected void btnSearch_Click(object sender, EventArgs e)
{ 
    DataSet ds1 = ws.daryafte_view_Personel_Information_with_parameter_cu_personal_number_Taradod(txtCodePers.Text.Trim());
    this.GridView1.DataSource = ds1;

    foreach (System.Data.DataTable tabale1 in ds1.Tables)
    {
        foreach (DataRow dr in tabale1.Rows)
        {
            txtName.Text = dr["tp_firstabbr_name"].ToString().Trim() + "  " + dr["tp_familyoffice_name"].ToString().Trim();
            txtMoavenat.Text = dr["tp_sbu"].ToString().Trim();
            Image1.ImageUrl = "~/image/" + txtCodePers.Text + ".jpg";
        }
    }
}


What I have tried:

I want to use another way except gridview
Posted
Updated 7-Aug-21 1:25am

1 solution

Just use the DataView directly - it doesn;t need to be bound to any display control: DataView In C#[^]
 
Share this answer
 
Comments
Member 15316187 7-Aug-21 7:53am    
Could you please show how to do this as in my code given in the question?
OriginalGriff 7-Aug-21 8:12am    
Follow the link - it gives an explanation and sample code.

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