Hi,
I use the ModalPopupExtender with the GridView to View/Edit data row.
My code working and don't have error, but when I type the name of the country I want to search in the txCountry TextBox, in the ModalPopup, the list appears behind the ModalPopup, i.e. as if I'm searching in the GridView.
Any suggestion? My code below.
<!--Start Panel to Edit record-->
<asp:Button ID="btnShow" Visible="true" runat="server" />
<ajax:ModalPopupExtender ID="ModalPopup" runat="server"
TargetControlID="btnShow"
BackgroundCssClass="modalBackground"
PopupControlID="PnlShow">
</ajax:ModalPopupExtender>
<asp:Panel ID="PnlShow" runat="server" Style="display: none; background-color: gainsboro;"
ForeColor="Black"
Width="900" Height="500">
<asp:Panel ID="panelEdit" runat="server"
Style="cursor: move; font-family: Tahoma; padding: 2px;"
HorizontalAlign="Center" BackColor="#cc0000"
ForeColor="White" Height="25">
<asp:AutoCompleteExtender
ServiceMethod="GetSearchUser"
ServicePath="Prefix.aspx"
MinimumPrefixLength="1"
CompletionInterval="10"
EnableCaching="false"
CompletionSetCount="10"
TargetControlID="txCountry"
ID="AutoCompleteExtender2"
runat="server"
FirstRowSelected="false">
</asp:AutoCompleteExtender>
<asp:Label ID="Label5" runat="server"
Text="Country *" Style="font-size: 12px; font-weight: bold; color: crimson;"></asp:Label>
<asp:TextBox ID="txCountry" runat="server"
CssClass="pure-u-23-24"></asp:TextBox>
</asp:Panel>
</asp:Panel>
<!--End Panel to Edit record-->
static MySqlDataAdapter da;
static DataTable dt;
[ScriptMethod()]
[WebMethod]
public static List<string> GetSearchUser(string prefixText)
{
DataTable Result = new DataTable();
string str = @String.Format("SELECT Country FROM `hCountry` ");
str += String.Format(" WHERE Country LIKE '" + prefixText + "%';");
using (MySqlConnection con =
new MySqlConnection(ConfigurationManager.ConnectionStrings["cn"].ConnectionString))
{
da = new MySqlDataAdapter(str, con);
dt = new DataTable();
da.Fill(dt);
List<string> Output = new List<string>();
for (int i = 0; i < dt.Rows.Count; i++)
Output.Add(dt.Rows[i][0].ToString());
return Output;
}
}