Home All Groups Group Topic Archive Search About
Author
2 Mar 2005 2:21 PM
Esperanza
Hello .net expert, I've made a litle  reserch function which allow the user
to find a client by name
or phone number (both are string format) .

Even if I know the value exist, the datagrid return me nothing.
Any Idea what would be the problem ??
Thanks in advance !!

Esperanza

//---------------------------------------------------------------------
private void btnLookFor_Click(object sender, System.EventArgs e)
  {

   string strVar;
   string strSelection;
   strVar = this.txtLookFor.Text;
   strSelection = this.RadListLookFor.SelectedItem.Text;

   try
   {
    if (strVar.Trim()!=null)
    {
     //See witch radio button was click
     switch(strSelection)

     {
      //Look by name
      case "Name":
      this.dataViewGPPL.RowFilter = "XABALPH like '%" + strVar + "%'";
      break;


      //Look by phone number
      case "No tel.":
      this.dataViewGPPL.RowFilter = "XTEL like '" + strVar + "'";
      break;
        }

       this.DataGrid1.DataSource = dataViewGPPL;
     this.DataGrid1.DataBind();

    }


   }

     catch (Exception ex)
   {
    throw ex;
   }

Author
2 Mar 2005 8:11 PM
Elton Wang
Hi Esperanza,

How do you fill whole data to the dataview?


>-----Original Message-----
>Hello .net expert, I've made a litle  reserch function
which allow the user
>to find a client by name
>or phone number (both are string format) .
>
>Even if I know the value exist, the datagrid return me
nothing.
>Any Idea what would be the problem ??
>Thanks in advance !!
>
>Esperanza
>
>//--------------------------------------------------------
-------------
>private void btnLookFor_Click(object sender,
System.EventArgs e)
Show quoteHide quote
>  {
>
>   string strVar;
>   string strSelection;
>   strVar = this.txtLookFor.Text;
>   strSelection = this.RadListLookFor.SelectedItem.Text;
>
>   try
>   {
>    if (strVar.Trim()!=null)
>    {
>     //See witch radio button was click
>     switch(strSelection)
>
>     {
>      //Look by name
>      case "Name":
>      this.dataViewGPPL.RowFilter = "XABALPH like '%" +
strVar + "%'";
>      break;
>
>
>      //Look by phone number
>      case "No tel.":
>      this.dataViewGPPL.RowFilter = "XTEL like '" +
strVar + "'";
>      break;
>        }
>
>       this.DataGrid1.DataSource = dataViewGPPL;
>     this.DataGrid1.DataBind();
>
>    }
>
>
>   }
>
>     catch (Exception ex)
>   {
>    throw ex;
>   }
>
>
>
>.
>
Author
2 Mar 2005 9:30 PM
Esperanza
That was it.
I didn't fill the dataSet before.

Thanks a lot !!
Esperanza
Show quoteHide quote
"Elton Wang" <anonym***@discussions.microsoft.com> a écrit dans le message
de news:39e301c51f63$faa778f0$a401280a@phx.gbl...
> Hi Esperanza,
>
> How do you fill whole data to the dataview?
>
>
> >-----Original Message-----
> >Hello .net expert, I've made a litle  reserch function
> which allow the user
> >to find a client by name
> >or phone number (both are string format) .
> >
> >Even if I know the value exist, the datagrid return me
> nothing.
> >Any Idea what would be the problem ??
> >Thanks in advance !!
> >
> >Esperanza
> >
> >//--------------------------------------------------------
> -------------
> >private void btnLookFor_Click(object sender,
> System.EventArgs e)
> >  {
> >
> >   string strVar;
> >   string strSelection;
> >   strVar = this.txtLookFor.Text;
> >   strSelection = this.RadListLookFor.SelectedItem.Text;
> >
> >   try
> >   {
> >    if (strVar.Trim()!=null)
> >    {
> >     //See witch radio button was click
> >     switch(strSelection)
> >
> >     {
> >      //Look by name
> >      case "Name":
> >      this.dataViewGPPL.RowFilter = "XABALPH like '%" +
> strVar + "%'";
> >      break;
> >
> >
> >      //Look by phone number
> >      case "No tel.":
> >      this.dataViewGPPL.RowFilter = "XTEL like '" +
> strVar + "'";
> >      break;
> >        }
> >
> >       this.DataGrid1.DataSource = dataViewGPPL;
> >     this.DataGrid1.DataBind();
> >
> >    }
> >
> >
> >   }
> >
> >     catch (Exception ex)
> >   {
> >    throw ex;
> >   }
> >
> >
> >
> >.
> >