Search Engine using Apex and Visualforce


<apex:page standardController="Member__c" extensions="Search" >

  <style type = "text/css">

    .Bld { font-weight:bold;}
  <apex:form >
    <apex:pageblock title="Members" >
      <table align = "center" width = "100%" cellspacing = "5">
          <td class = "Bld">Member Name:</td>
          <td><apex:inputText value="{!memName}" /></td>         
          <td align = "center" class = "Bld" colspan = "2"><apex:commandButton value="Find" action="{!find}"/></td>
    <apex:pageBlock title="Search Result">
      <apex:pageblockTable value="{!memList}" var="a">
        <apex:column >
          <apex:outputlink value="{!}">{!a.Name}</apex:outputlink>
        <apex:column value="{!}"/>


public class Search
  public String memName {get; set;}
  public List<Member__c>  memList {get; set;}
  public Search(ApexPages.StandardController controller)
  public void find()
    String sql = 'SELECT Name,id FROM Member__c WHERE Name LIKE \'%'+memName+'%\' LIMIT 20';
    memList = Database.query(sql);

No comments:

Post a Comment

Sharing is Caring!!! Share this with your friends!!!

submit to reddit