[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


ListView Control Update not working

Posted on 2011-04-27
Medium Priority
Last Modified: 2012-05-11
I have a search engine on my site which selects from a database and allows user to edit the records  , all works fine , but basically I need to programatically define the "select all ' command so my datalist shows all records  from the db . My current code is working but the issue is that once I try to edit the record, it takes me to the first page and does not go into edit mode...
<asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/Providers.mdb"
        DeleteCommand = " DELETE * From [tbl_Providers] WHERE [ID] = ?" 
        UpdateCommand="UPDATE [tbl_Providers] SET [Provider_Type] = ?, [Last_Name] = ?, [First_Name] = ?, [Prof_Designation] = ?, [Group_Business_Name] = ?, [Specialty] = ?, [Specialty2] = ?, [Address] = ?, [Address2] = ?, [City] = ?, [State] = ?, [Zip] = ?, [Phone] = ?, [Fax] = ? WHERE [ID] = ? "    
        SelectCommand="SELECT [Id],[First_Name],[Last_Name],[Prof_Designation], [Specialty], [Specialty2],[Address], [Address2], [City], [State], [Zip], [Phone], [Fax],[Provider_Type],[Group_Business_Name] FROM [tbl_Providers] WHERE  
        ((@First_Name IS NULL OR First_Name LIKE '%' +  @First_Name + '%') OR
        (@Last_Name IS NULL OR Last_Name LIKE '%' +  @Last_Name + '%')) AND
       ( (@Specialty IS NULL OR Specialty LIKE '%' + @Specialty + '%') OR
        (@Specialty IS NULL OR Specialty2 LIKE '%' + @Specialty + '%'))" 
            <asp:ControlParameter ControlID="providerTextBox" Name="First_Name" PropertyName="Text"
                Type="String" ConvertEmptyStringToNull="true" />
            <asp:ControlParameter ControlID="providerTextBox" Name="Last_Name" PropertyName="Text"
                Type="String" ConvertEmptyStringToNull="true" />
            <asp:ControlParameter ControlID="specialityDropDown" Name="Specialty" PropertyName="SelectedValue"
                Type="String" ConvertEmptyStringToNull="true" />

Open in new window

Protected Sub ListView1_PagePropertiesChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.PagePropertiesChangingEventArgs) Handles ListView1.PagePropertiesChanging
        Dim pager As DataPager = DirectCast(DirectCast(sender, ListView).FindControl("DataPager1"), DataPager)
        'pager.SetPageProperties(e.StartRowIndex, e.MaximumRows, False)
        Dim sql1 As String
        sql1 = "SELECT [Id],[First_Name],[Last_Name],[Prof_Designation], [Specialty], [Specialty2],[Address], [Address2], [City], [State], [Zip], [Phone], [Fax],[Provider_Type],[Group_Business_Name] FROM [tbl_Providers]"
        AccessDataSource1.SelectCommand = sql1

    End Sub

Open in new window

Question by:TonyReba
  • 2

Expert Comment

ID: 35482003
could you post the full page code please, I'm also wondering if you need to qualify the PagePropertiesChanging event to only fire that selectCommand when it's not in Edit mode

Author Comment

ID: 35491699
How would I declare this event?

Accepted Solution

mr_nadger earned 2000 total points
ID: 35492188
check the event list in the control properties

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
Suggested Courses
Course of the Month19 days, 18 hours left to enroll

873 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