?
Solved

spooky webform

Posted on 2004-11-29
27
Medium Priority
?
371 Views
Last Modified: 2008-02-01
hi,guys.this is quite a weird one,

my search button validates my search box (txtRoleSearch) to make sure the textbox is not empty
however, my add button(one the same webform) also validates the textbox above(this show not be happening)
what seem to be the problem?? anything to do with postback or what???

mind you, the add button has its on textbox(txtadd)

thanks

SirReadalot
0
Comment
Question by:SirReadAlot
  • 16
  • 7
  • 2
  • +2
27 Comments
 

Author Comment

by:SirReadAlot
ID: 12696174
the validation is done on the aspx
<table id="tblSearch" style="Z-INDEX: 103; LEFT: 312px; POSITION: absolute; TOP: 16px"
borderColor="#003300" align="center" border="1" runat="server">
<tr>
<td class="LabelText" style="WIDTH: 121px">Search:</td>
<td><asp:textbox id="txtSearch" runat="server" Columns="20" CssClass="LabelText"></asp:textbox></td>
<td><asp:requiredfieldvalidator id="rfvSearch" CssClass="AlertText" Runat="server" Width="184" Font-Size="8pt" Display="Dynamic"
ControlToValidate="txtSearch">Enter a Search Criteria
<img src="../../../images/buttons/arrow_alert.gif"></asp:requiredfieldvalidator></td>
</tr>
<tr>
<td><asp:button id="btnSearch" Runat="server" Text="Search" BorderStyle="Solid"></asp:button></td>
</tr>
</table>
0
 
LVL 25

Expert Comment

by:nauman_ahmed
ID: 12696293
The problem you are facing in this scenario is very common. Since both the buttons are server side controls, you will see the validation failure message. Adding a normal HTML button and handle the validation through JavaScript should solve your problem. You can use the following for the validation:

<script language="javascript">
function ValidateSearch()
{
     if (document.forms[0].txtSearch.value == "")
     {
          alert("Please enter the search text");
          return false;
      }
}
</script>

<input type="button" value="search" onClick="javascript: return ValidateSearch();">

Best, Nauman.
0
 

Author Comment

by:SirReadAlot
ID: 12696341
so javascript is the only way out?? i have avoided it for a long time
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:khareatul
ID: 12696421
Try:

just set the causesvalidation property of add button to false.
0
 

Author Comment

by:SirReadAlot
ID: 12696485
thanks for the tip k, but my add button needs some validation as well
i guess i have to do the javascript
0
 

Author Comment

by:SirReadAlot
ID: 12696667
any further sugggestion b/4 i proceed with javascript??
0
 
LVL 9

Expert Comment

by:hismightiness
ID: 12697169
Wouldn't this be easier using Validation Controls and controlling the event handling in the codebehind?
0
 

Author Comment

by:SirReadAlot
ID: 12697429
Wouldn't this be easier using Validation Controls and controlling the event handling in the codebehind?
i haven't tried this b/4 but if you could show some code example or a link to an article that would be fine. I STRONGLY WANT TO AVOID JAVASCRIPT!!


thanks

SirReadAlot
0
 

Author Comment

by:SirReadAlot
ID: 12697778
any other
0
 
LVL 25

Expert Comment

by:nauman_ahmed
ID: 12698086
If you are in the Internet development, you can't escape from JavaScript :p as sometimes its the only resort. Also make sure that you implement the functionality incase JavaScript is disabled in the user browser. On the Click event of the button make sure that the txtSearch value is not null. Also for the button that do ASP .NET validation, validate the form on server side too. Use a validation summary control for this purpose

private void ButtonAdd_Click(object Sender, EventArgs e)
{
   Page.Validate();
   if (!Page.IsValid())
   {
      ValidationSummary1.ShowSummary = true;
    }
   else
   {
       //more code  
   }
}

HTH, Nauman.
0
 
LVL 9

Expert Comment

by:hismightiness
ID: 12698791
Post the HTML example of your page and I can reply with the Validators included.  Just let me know which each textfield is supposed to do.
0
 

Author Comment

by:SirReadAlot
ID: 12699512
sorry for the delay, the txt fields are, txtRoleName,txtRoleSearch

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="AdminRoles.aspx.vb" Inherits="Expenses.AdminRoles" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>AdminRoles</title>
<LINK href=" ../../css/panels.css" type="text/css" rel="stylesheet">
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="FrmAddRoles" method="post" runat="server">
<table id="tblRoles" style="Z-INDEX: 101; LEFT: 304px; WIDTH: 385px; POSITION: absolute; TOP: 112px; HEIGHT: 207px"
borderColor="#003300" align="center" border="1" runat="server">
<tr>
<td class="labelText" style="WIDTH: 256px">Role Name:</td>
<td><asp:textbox id="txtRoleName" Columns="20" CssClass="labelText" Runat="server"></asp:textbox></td>
<td><asp:button id="btnAdd" Runat="server" Text="Add" BorderStyle="Solid"></asp:button></td>
</tr>
<tr>
<td style="WIDTH: 256px">
<asp:datagrid id="dgRoles" Runat="server" Height="75px" Width="297px" AutoGenerateColumns="False"
BorderWidth="2px" DataKeyField="RoleID" BorderColor="black" CellPadding="3" GridLines="Both"
AlternatingItemStyle-BackColor="#eeeeee" HeaderStyle-BackColor="#ff8040" Font-Size="8pt" Font-Name="Verdana"
OnEditCommand="OnEdit" OnCancelCommand="Oncancel" OnUpdateCommand="OnUpdate">
<Columns>
<asp:TemplateColumn HeaderText="Roles">
<ItemTemplate>
<asp:Label text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"Role"))%>' Runat="server" ID="lblRoles"/>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox Runat="server" ID="txtRole" Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"Role"))%>' width="150"/>
</EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Delete">
<ItemTemplate>
<asp:CheckBox ID="chkSelection" Enabled="true" runat="server" />
<asp:Label ID="RoleDelete" Visible="False" Text='<%# DataBinder.Eval(Container.DataItem, "RoleID") %>' Runat=server />
</ItemTemplate>
</asp:TemplateColumn>
<asp:EditCommandColumn EditText="Edit" CancelText="Cancel" UpdateText="Update"></asp:EditCommandColumn>
<asp:TemplateColumn HeaderText="Sections">
<ItemTemplate>
<asp:DataGrid ID="dgNewSection" Runat="server" BorderStyle="None" BorderWidth="0" CellPadding="3"
CellSpacing="0" Width="100%" AutoGenerateColumns="False" Font-Size="8pt" Font-Name="Verdana"
GridLines="Both">
<Columns>
<asp:BoundColumn DataField="SectionName" HeaderText="Section Name"></asp:BoundColumn>
</Columns>
</asp:DataGrid>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="SectionLevel">
<ItemTemplate>
<asp:DropDownList id="ddlSectionLevels" runat="server" />
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid></td>
</tr>
<tr>
<td style="WIDTH: 85px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:button id="btnDelete" runat="server" Text="Delete" BorderStyle="Solid"></asp:button></td>
</tr>
</table>
<table id="tblRoleSearch" style="Z-INDEX: 103; LEFT: 328px; POSITION: absolute; TOP: 528px"
align="center" runat="server">
<tr>
<td class="LabelText" style="WIDTH: 121px">Search:</td>
<td><asp:textbox id="txtRoleSearch" runat="server" Columns="20" CssClass="LabelText"></asp:textbox></td>
<td><asp:button id="btnSearch" Runat="server" Text="Search" BorderStyle="Solid"></asp:button></td>
</tr>
</table>
<asp:label id="lblError" style="Z-INDEX: 102; LEFT: 320px; POSITION: absolute; TOP: 56px" runat="server"
CssClass="LabelText" Height="25px" Width="336px"></asp:label></form>
</body>
</HTML>
0
 
LVL 9

Expert Comment

by:hismightiness
ID: 12699602
See if this works for now.  However, it would be better to split the two different searches so you can validate them both when submitted.  I will post an example in a few minutes.

<table id="tblRoles" style="Z-INDEX: 101; LEFT: 304px; WIDTH: 385px; POSITION: absolute; TOP: 112px; HEIGHT: 207px"
                        borderColor="#003300" align="center" border="1" runat="server">
                        <tr>
                              <td class="labelText" width="256">Role Name:</td>
                              <td><asp:textbox id="txtRoleName" Columns="20" CssClass="labelText" Runat="server"></asp:textbox></td>
                              <td><asp:button id="btnAdd" Runat="server" Text="Add" BorderStyle="Solid" CausesValidation="False"></asp:button></td>
                        </tr>
                        <tr>
                              <td width="256">
                                    <asp:datagrid id="dgRoles" Runat="server" Height="75px" Width="297px" AutoGenerateColumns="False"
                                          BorderWidth="2px" DataKeyField="RoleID" BorderColor="black" CellPadding="3" GridLines="Both"
                                          AlternatingItemStyle-BackColor="#eeeeee" HeaderStyle-BackColor="#ff8040" Font-Size="8pt" Font-Name="Verdana"
                                          OnEditCommand="OnEdit" OnCancelCommand="Oncancel" OnUpdateCommand="OnUpdate">
                                          <Columns>
                                                <asp:TemplateColumn HeaderText="Roles">
                                                      <ItemTemplate>
                                                            <asp:Label text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"Role"))%>' Runat="server" ID="lblRoles"/>
                                                      </ItemTemplate>
                                                      <EditItemTemplate>
                                                            <asp:TextBox Runat="server" ID="txtRole" Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"Role"))%>' width="150"/>
                                                      </EditItemTemplate>
                                                </asp:TemplateColumn>
                                                <asp:TemplateColumn HeaderText="Delete">
                                                      <ItemTemplate>
                                                            <asp:CheckBox ID="chkSelection" Enabled="true" runat="server" />
                                                            <asp:Label ID="RoleDelete" Visible="False" Text='<%# DataBinder.Eval(Container.DataItem, "RoleID") %>' Runat=server />
                                                      </ItemTemplate>
                                                </asp:TemplateColumn>
                                                <asp:EditCommandColumn EditText="Edit" CancelText="Cancel" UpdateText="Update"></asp:EditCommandColumn>
                                                <asp:TemplateColumn HeaderText="Sections">
                                                      <ItemTemplate>
                                                            <asp:DataGrid ID="dgNewSection" Runat="server" BorderStyle="None" BorderWidth="0" CellPadding="3"
                                                                  CellSpacing="0" Width="100%" AutoGenerateColumns="False" Font-Size="8pt" Font-Name="Verdana"
                                                                  GridLines="Both">
                                                                  <Columns>
                                                                        <asp:BoundColumn DataField="SectionName" HeaderText="Section Name"></asp:BoundColumn>
                                                                  </Columns>
                                                            </asp:DataGrid>
                                                      </ItemTemplate>
                                                </asp:TemplateColumn>
                                                <asp:TemplateColumn HeaderText="SectionLevel">
                                                      <ItemTemplate>
                                                            <asp:DropDownList id="ddlSectionLevels" runat="server" />
                                                      </ItemTemplate>
                                                </asp:TemplateColumn>
                                          </Columns>
                                    </asp:datagrid></td>
                        </tr>
                        <tr>
                              <td width="85">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <asp:button id="btnDelete" runat="server" Text="Delete" BorderStyle="Solid"></asp:button></td>
                        </tr>
                  </table>
                  <table id="tblRoleSearch" style="Z-INDEX: 103; LEFT: 328px; POSITION: absolute; TOP: 528px"
                        align="center" runat="server">
                        <TR>
                              <TD class="LabelText" width="121" colSpan="3">
                                    <asp:RequiredFieldValidator id="rfvSearchBox" runat="server" ErrorMessage="Please enter a Search value" Display="Dynamic"
                                          ToolTip="Please enter a Search value" ControlToValidate="txtRoleSearch">Please enter a Search value</asp:RequiredFieldValidator></TD>
                        </TR>
                        <tr>
                              <td class="LabelText" width="121">Search:</td>
                              <td><asp:textbox id="txtRoleSearch" runat="server" Columns="20" CssClass="LabelText"></asp:textbox></td>
                              <td><asp:button id="btnSearch" Runat="server" Text="Search" BorderStyle="Solid"></asp:button></td>
                        </tr>
                  </table>
                  <asp:label id="lblError" style="Z-INDEX: 102; LEFT: 320px; POSITION: absolute; TOP: 56px" runat="server"
                        CssClass="LabelText" Height="25px" Width="336px"></asp:label>
0
 
LVL 9

Accepted Solution

by:
hismightiness earned 2000 total points
ID: 12699731
Here is the example I was talking about (codebehind at the bottom):

--------------------- BEGIN HTML ------------------------------

<TABLE height="601" cellSpacing="0" cellPadding="0" width="684" border="0" ms_2d_layout="TRUE">
            <TR vAlign="top">
                  <TD width="169" height="56"></TD>
                  <TD width="12"></TD>
                  <TD width="147"></TD>
                  <TD width="356"></TD>
            </TR>
            <TR vAlign="top">
                  <TD colSpan="2" height="56"></TD>
                  <TD colSpan="2">
                        <asp:label id="lblError" runat="server" CssClass="LabelText" Height="25px" Width="336px"></asp:label></TD>
            </TR>
            <TR vAlign="top">
                  <TD height="416"></TD>
                  <TD colSpan="3">
                        <table id="tblRoles" borderColor="#003300" align="center" border="1" runat="server" height="207"
                              width="385">
                              <tr>
                                    <td class="labelText">Role Name:</td>
                                    <td><asp:textbox id="txtRoleName" Columns="20" CssClass="labelText" Runat="server"></asp:textbox>
                                          <asp:RequiredFieldValidator id="rfvRoleName" runat="server" ErrorMessage="Please enter a Role Name" ToolTip="Please enter a Role Name"
                                                ControlToValidate="txtRoleName">!</asp:RequiredFieldValidator></td>
                                    <td><asp:button id="btnAdd" Runat="server" Text="Add" BorderStyle="Solid"></asp:button></td>
                              </tr>
                              <tr>
                                    <td width="256" colSpan="3">
                                          <asp:datagrid id="dgRoles" Runat="server" OnUpdateCommand="OnUpdate" OnCancelCommand="Oncancel"
                                                OnEditCommand="OnEdit" Font-Name="Verdana" Font-Size="8pt" HeaderStyle-BackColor="#ff8040"
                                                AlternatingItemStyle-BackColor="#eeeeee" GridLines="Both" CellPadding="3" BorderColor="black"
                                                DataKeyField="RoleID" BorderWidth="2px" AutoGenerateColumns="False" Width="297px" Height="75px">
                                                <Columns>
                                                      <asp:TemplateColumn HeaderText="Roles">
                                                            <ItemTemplate>
                                                                  <asp:Label text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"Role"))%>' Runat="server" ID="lblRoles"/>
                                                            </ItemTemplate>
                                                            <EditItemTemplate>
                                                                  <asp:TextBox Runat="server" ID="txtRole" Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"Role"))%>' width="150"/>
                                                            </EditItemTemplate>
                                                      </asp:TemplateColumn>
                                                      <asp:TemplateColumn HeaderText="Delete">
                                                            <ItemTemplate>
                                                                  <asp:CheckBox ID="chkSelection" Enabled="true" runat="server" />
                                                                  <asp:Label ID="RoleDelete" Visible="False" Text='<%# DataBinder.Eval(Container.DataItem, "RoleID") %>' Runat=server />
                                                            </ItemTemplate>
                                                      </asp:TemplateColumn>
                                                      <asp:EditCommandColumn EditText="Edit" CancelText="Cancel" UpdateText="Update"></asp:EditCommandColumn>
                                                      <asp:TemplateColumn HeaderText="Sections">
                                                            <ItemTemplate>
                                                                  <asp:DataGrid ID="dgNewSection" Runat="server" BorderStyle="None" BorderWidth="0" CellPadding="3"
                                                                        CellSpacing="0" Width="100%" AutoGenerateColumns="False" Font-Size="8pt" Font-Name="Verdana"
                                                                        GridLines="Both">
                                                                        <Columns>
                                                                              <asp:BoundColumn DataField="SectionName" HeaderText="Section Name"></asp:BoundColumn>
                                                                        </Columns>
                                                                  </asp:DataGrid>
                                                            </ItemTemplate>
                                                      </asp:TemplateColumn>
                                                      <asp:TemplateColumn HeaderText="SectionLevel">
                                                            <ItemTemplate>
                                                                  <asp:DropDownList id="ddlSectionLevels" runat="server" />
                                                            </ItemTemplate>
                                                      </asp:TemplateColumn>
                                                </Columns>
                                          </asp:datagrid>&nbsp;&nbsp;</td>
                              </tr>
                              <tr>
                                    <td align="left">
                                          <asp:button id="btnDelete" runat="server" Text="Delete" BorderStyle="Solid"></asp:button></td>
                                    <td align="right" colSpan="2">
                                          <asp:LinkButton id="lnkToggleSearch" runat="server" CausesValidation="False">Search Roles</asp:LinkButton></td>
                              </tr>
                        </table>
                  </TD>
            </TR>
            <TR vAlign="top">
                  <TD colSpan="3" height="73"></TD>
                  <TD>
                        <table id="tblRoleSearch" align="center" runat="server" height="72" width="355">
                              <TR>
                                    <TD class="LabelText" width="121" colSpan="3">
                                          <asp:RequiredFieldValidator id="rfvSearchBox" runat="server" ErrorMessage="Please enter a Search value" Display="Dynamic"
                                                ToolTip="Please enter a Search value" ControlToValidate="txtRoleSearch">Please enter a Search value</asp:RequiredFieldValidator></TD>
                              </TR>
                              <tr>
                                    <td class="LabelText" width="121">Search:</td>
                                    <td><asp:textbox id="txtRoleSearch" runat="server" Columns="20" CssClass="LabelText"></asp:textbox></td>
                                    <td><asp:button id="btnSearch" Runat="server" Text="Search" BorderStyle="Solid"></asp:button></td>
                              </tr>
                        </table>
                  </TD>
            </TR>
      </TABLE>
--------------------- END HTML ------------------------------


--------------- BEGIN CODEBEHIND -----------------------------

    Private Sub lnkToggleSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lnkToggleSearch.Click
        If tblRoleSearch.Visible = True Then
            lnkToggleSearch.Text = "Cancel Search"
            rfvRoleName.Enabled = True
            tblRoleSearch.Visible = False
            btnAdd.Enabled = True
        Else
            lnkToggleSearch.Text = "Search"
            rfvRoleName.Enabled = False
            tblRoleSearch.Visible = True
            btnAdd.Enabled = False
        End If
    End Sub

--------------- END CODEBEHIND -----------------------------
0
 
LVL 4

Expert Comment

by:dukestaTAI
ID: 12700145
I would not rely on JavaScript Validation Alone, it is easily bypassed with a simple browser setting, or may not even be available for some browsers.
0
 

Author Comment

by:SirReadAlot
ID: 12700170
Hi, His!! i will have to try this out at the office tomorrow morning. it anout 9.00pm  u.k time, i will give u some feedback tomorrow. thanks


sirreadalot
0
 

Author Comment

by:SirReadAlot
ID: 12700304
hi, his, i have briefly tested it, it works one way. meaning on page load both buttons are visible, if i click on search, it fires the validation of the add button and vice versa


0
 
LVL 9

Expert Comment

by:hismightiness
ID: 12700331
Let me know if I can help you any further when you test it in the morning.  :)
0
 

Author Comment

by:SirReadAlot
ID: 12704135
hey his, just tested it.

changed so things. I am using buttons instead of the link stuff.
1)i want the search table to be invisbile on page load so i did this(tblRoleSearch.Visible = False)
2)so if u want to search u click on the lookup button, but the "cancel search" is not coming up so that the add button will be enabled
3)after search, the tblRoleSearch becomes invisible, probably because of step one above.

==========================here is the code behind=========
Private Sub lnkSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lnkSearch.Click
        If tblRoleSearch.Visible = True Then
            tblRoleSearch.Visible = False
            btnAdd.Enabled = True
            rfvAddRoles.Enabled = False
            lnkSearch.Text = "Cancel Search"
        Else
            tblRoleSearch.Visible = True
            btnAdd.Enabled = False
            rfvAddRoles.Enabled = False
            lnkSearch.Text = "Search"
        End If
    End Sub
0
 

Author Comment

by:SirReadAlot
ID: 12704139
forget step 2, am now using linkbutton


thanks
0
 

Author Comment

by:SirReadAlot
ID: 12704189
turn it around here so step 2 is kinda fine
Private Sub lnkToggleSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lnkToggleSearch.Click
        If tblRoleSearch.Visible = True Then
            lnkToggleSearch.Text = "Cancel Search"
            rfvRoleName.Enabled = True
            tblRoleSearch.Visible = False
            btnAdd.Enabled = True
        Else
            lnkToggleSearch.Text = "Search"
            rfvRoleName.Enabled = False
            tblRoleSearch.Visible = True
            btnAdd.Enabled = False
        End If
    End Sub
0
 

Author Comment

by:SirReadAlot
ID: 12704283
basically, the search table needs to be invisible on first page load (tblRoleSearch.Visible = False)
then
even if the result of the search is null/something, the  tblRoleSearch should be switched off only when i click cancel search.

thanks in advance

SirReadalot
0
 

Author Comment

by:SirReadAlot
ID: 12704346
with this code am saying,
1)if the search produces a result then tblsearchrole is visible
2)and if its out put is null then tblsearchrole is visible
3) however when i click cancel search, the tblsearchrole is still visible----how do i go around this, as i only want to disable
tblsearchrole when the cancel link button is clicked.... thanks in advance

====================================================================
Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click
        'Get values from textbox's
        Dim strSearch As String
        strSearch = txtRoleSearch.Text
        'Instantiate business class
        Dim RoleSearch As New Roles
        'set a dataset to executed dataset
        Dim dv As New DataView
        dv = RoleSearch.SearchRoles(strSearch)
        If strSearch = "" Then
            strSearch = "%"
        End If
        'bid dataset to datagrid
        If dv.Count > 0 Then
            With dgRoles
                .DataSource = dv
                .DataMember = "Roles"
                .DataKeyField = "Roleid"
                dgRoles.DataBind()
            End With
            'Turns datagrid, label & table off/on
            dgRoles.Visible = True
            lblError.Visible = False
            tblRoles.Visible = True
            tblRoleSearch.Visible = True
        Else
            dgRoles.Visible = False
            lblError.Visible = True
            tblRoles.Visible = False
            tblRoleSearch.Visible = True
            'If no results, show message in label
            lblError.Text = "No Records Found. Please search again"
        End If
        txtRoleSearch.Text = ""
    End Sub
0
 

Author Comment

by:SirReadAlot
ID: 12704358
anyone??
0
 
LVL 9

Expert Comment

by:hismightiness
ID: 12705460
I just got in to work.  I will get back on this in a little bit...
0
 

Author Comment

by:SirReadAlot
ID: 12705602
Hi there, I have solved the problem and using button instead of link button===codebehind==================== but this time the datagrid is firing the textbox validation??/  seems to be a comedy of errors here.........
Private Sub btnSchRole_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSchRole.Click
        If tblRoleSearch.Visible = True Then
            tblRoleSearch.Visible = False
            btnAdd.Enabled = True
        Else
            tblRoleSearch.Visible = True
            btnAdd.Enabled = False
        End If
    End Sub
======================================================thanks==========================
0
 
LVL 9

Expert Comment

by:hismightiness
ID: 12706630
I haven't gotten a chance to plug in your code yet, but anything that is:

visible=false OR enabled=false

will not be validated by the page.  So, if you leave something up there and do not want it validated, either disable that control or it's validation control.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Integration Management Part 2
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question