Danish Habib

Danish Habib

  • NA
  • 694
  • 233.9k

I have a page in which i have a search box textbox N button

Mar 9 2016 2:18 AM
I have a web page in which i have  a searchbox and a button to click  for searching the records from the database just like the below image 
 
 
 
when i click on the text box and press enter my page automatically goes into the edit mode of gridview why it is so ? please assists me i am sending you the markup of my page as  well as below.
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:UpdatePanel ID="udpSecurityQuestions" runat="server">
<ContentTemplate>
<div id='box'>
<h4 style="font-family: Verdana; color: Red;">
Important Note:</h4>
To add a new indicator remember these things if the target value for indicator has
options like Men,women,Boy,Girl then you much check the Multivalue check box.
<asp:LinkButton ID="lnkindicatorcreateguide" runat="server" CssClass="BodyHeadNormal"
Text="guide for creating indicators" />
<br />
<asp:HyperLink ID="hypGuideback" style="color:Fuchsia; font-family:Verdana; text-decoration:underline;font-size:medium;" visible="false" runat="server" NavigateUrl="~/CreateIndicators.aspx" Text="go back"></asp:HyperLink>
</div>
<div class="SearchBox">
<div class="left">
<div id="admins" runat="server" visible="false" style="margin: 0px;">
<asp:CheckBox name="chkSearchIsAdmin" ID="chkSearchIsAdmin" runat="server" CssClass="check-box"
Checked="false" Style="vertical-align: text-bottom;" />
<label for="chkSearchIsAdmin" class="forcheckbox" style="vertical-align: top; color: White;">
Admin</label>
</div>
<asp:CheckBox ID="chkSearchIsActive" name="admin" runat="server" CssClass="check-box"
Checked="true" Style="vertical-align: text-bottom;" />
<label class="admin" for="chkSearchIsActive" style="vertical-align: top; color: White;">
Active</label>
&nbsp;
<br />
<div class="clear">
</div>
<div class="SecondRow">
<label style="color: White;">
Question Text <span style="color: #ff0000; vertical-align: middle;"></span>
</label>
<asp:TextBox ID="txtSearchName" runat="server" CssClass="TextBox" MaxLength="50"
Width="200px" Style="margin-left: 25px;"></asp:TextBox>
<label style="color: White;">
Question Type <span style="color: #ff0000; vertical-align: middle; margin-left: 20px;"></span>
</label>
<asp:DropDownList ID="DropDownList1" runat="server" CssClass="TextBox" DataTextField="Name" DataValueField="Name">
</asp:DropDownList>
</div>
<div class="Temp">
<asp:Button ID="btnSearch" runat="server" Text="Search" CssClass="Button" UseSubmitBehavior="False"
Height="30px" Width="61px" />
</div>
</div>
</div>
<div class="clear"></div><br /><br />
<table border="0" cellpadding="0" cellspacing="0" width="800px">
<tr>
<td style="width: 800px; text-align: justify; vertical-align: top;">
<asp:MultiView ID="mvSecurityQuestions" runat="server" ActiveViewIndex="0">
<asp:View ID="vRecords" runat="server">
<fieldset>
<asp:LinkButton ID="btnAddNew" runat="server" CssClass="BodyHeadNormal" Text="Add New" />
</fieldset>
<br />
<div>
<asp:GridView ID="grdSecurityQuestions" runat="server" AllowPaging="True" Width="802px"
GridLines="None" AutoGenerateColumns="False" DataKeyNames="QuestionIds" CssClass="items"
EmptyDataText="No Records could be Found" PageSize="15">
<EmptyDataRowStyle ForeColor="#CC0000" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<%# Container.DataItemIndex + 1 %>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Descritpion of Indicators">
<ItemTemplate>
<asp:Literal ID="litSecurityQuestion" runat="server" Text='<%# Eval("QuestionText") %>'></asp:Literal>
</ItemTemplate>
<ItemStyle Width="80%" />
</asp:TemplateField>
<asp:TemplateField HeaderText=" Question Type">
<ItemTemplate>
<asp:Literal ID="litQuestionType" runat="server" Text='<%# Eval("ControlScr") %>'></asp:Literal>
</ItemTemplate>
<ItemStyle Width="80%" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Active">
<ItemTemplate>
<asp:Literal ID="litActive" runat="server" Text='<%# Eval("IsActive") %>'></asp:Literal>
</ItemTemplate>
<ItemStyle Width="12%" />
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="imgBtnEdit" runat="server" ImageUrl="~/Resources/Images/edit.png"
CausesValidation="false" CommandName="edit" AlternateText="Edit" ToolTip="Edit" />
<asp:LinkButton ID="btnGridDelete" runat="server" CommandName="Delete" CssClass="MessageBoxLink"
OnClientClick="return ( confirm(&quot;Are you sure, you want to Remove?&quot;) );"
CausesValidation="False"><img border="0" src="Resources/Images/trash.png" alt="Delete Record" /></asp:LinkButton>
</ItemTemplate>
<ItemStyle Width="8%" />
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</asp:View>
<asp:View ID="vSave" runat="server">
<fieldset>
<label class="BodyTextHint">
Values for all the fields marked with <span style="color: #FF0000; vertical-align: middle;">
*</span> must be provided.
</label>
<asp:HiddenField ID="hdnSecurityQuestionId" runat="server" />
</fieldset>
<fieldset>
<label>
Create Indicators <span style="color: #FF0000; vertical-align: middle;">*</span>
</label>
<asp:Literal ID="litNewsId" runat="server" Visible="False"></asp:Literal>
</fieldset>
<fieldset>
<asp:TextBox ID="txtSecurityQuestion" runat="server" CssClass="TextBox" TextMode="MultiLine"
Width="650px"></asp:TextBox>
</fieldset>
<fieldset>
<asp:RequiredFieldValidator ID="vrqTitle" runat="server" ControlToValidate="txtSecurityQuestion"
Display="Dynamic" SetFocusOnError="True" Text=" Question must not be left blank.&lt;br /&gt;"
CssClass="Validator" ValidationGroup="Node"></asp:RequiredFieldValidator>
</fieldset>
<div class="clear">
</div>
<br />
<fieldset class="bulk-actions">
<asp:CheckBox ID="cbIsActive" runat="server" Checked="true"></asp:CheckBox>
<asp:Literal ID="litAcitve" runat="server" Text="Active"></asp:Literal>
</fieldset>
<fieldset class="bulk-actions">
<asp:CheckBox ID="chkLatest" runat="server" CssClass="check-box" Checked="true" />
<label class="forcheckbox">
MultiValue</label>
</fieldset>
<br />
<label>
Question Type<span style="color: #FF0000; vertical-align: middle;">*</span></label>
<fieldset>
<asp:DropDownList ID="ddlQuestionType" runat="server" DataTextField="Name" DataValueField="Name">
</asp:DropDownList>
<br />
</fieldset><br />
<fieldset>
<label>
Country Programs <span style="color: #FF0000; vertical-align: middle;">*</span></label><br /><br />
<asp:DropDownList ID="ddlCP" runat="server" DropDownStyle="DropDownList"
Width="200px" AutoCompleteMode="Suggest" CaseSensitive="False" CssClass="TextBox">
</asp:DropDownList>
</fieldset>
<br />
<fieldset>
<asp:Button ID="btnSave" runat="server" CssClass="Button" Text="Save" UseSubmitBehavior="False"
ValidationGroup="Node" />
&nbsp;
<asp:Button ID="btnCancel" runat="server" CssClass="Button" Text="Cancel" UseSubmitBehavior="False"
CausesValidation="false" />&nbsp;&nbsp;
<div style="width: 300px; float: right; vertical-align: top; margin-right: 275px;">
<asp:Panel ID="pnlDeleteRecord" runat="server" Visible="false">
<asp:Button ID="btnDeleteRecord" runat="server" Text="Delete" CssClass="Button" UseSubmitBehavior="False"
CommandName="delete" ToolTip="Delete the current page and its associated all contents." />
</asp:Panel>
</div>
</fieldset>
</asp:View>
<asp:View ID="guide" runat="server">
<fieldset>
<img src="../img/guide.png" alt="information" />
</fieldset>
</asp:View>
</asp:MultiView>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>

Answers (1)