Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7999747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:35:30+00:00 2026-06-04T15:35:30+00:00

i have a gridview automaticly connecting with sqldatasource1, etc. For the grid, I also

  • 0

i have a gridview automaticly connecting with sqldatasource1, etc. For the grid, I also have a search textbox If the user needs to filter the records it calls an another ((sqldatasource2-another procuder)) and put it in the same gridview ..,so i need to change the gridView.datasourceID to the another sqldatasource onclick a button ..

note :
sqldatasource1 and sqldatasource2 returning the same queries ,

the procuder of sqldatasource1 :

create proc AfficheDossiers
@Nom_GIAC varchar(50)
as
 begin
 select [ID_Dossier] as 'ID_Dossier'
      ,[ID_Entreprise] as 'ID_Entreprise'
      ,[Date_Depot] as 'Date_Dépôt'
      ,[Type_Etude] as 'Type_Etude'
      ,[Dernier_Type] as 'Dernier_Type'
      ,[Eligibile] as 'Eligibilité'
      ,[Fiche_Information] as 'Fiche_Information'
      ,[Buletin_Adhesion] as 'Bulletin_d’adhésion'
      ,[Fiche_Renseignment] as 'Fiche_Renseignment'
      ,[Attestation] as 'Attestation'
      ,[Date_Debut] as 'Date_Début'
      ,[Date_Fin] as 'Date_Fin'
      ,[ID_Cabinet] as 'ID_Cabinet'
      ,[Montant_Demander] as 'Montant_Demander'
      ,[Duree] as 'Durée'
      ,[Porcentage_Taux] as 'Pourcentage,Taux' from Dossier where Nom_Giac = @Nom_GIAC 
 end

the procuder of sqldatasource2((searche) :

alter proc rechercherGIAC @nomgiac varchar(20),@nom varchar(30),@par varchar(50)
           as
            begin
            if @nom='CNSS' 
              begin
              select d.[ID_Dossier] as 'ID_Dossier'
              ,d.[ID_Entreprise] as 'ID_Entreprise'
              ,[Date_Depot] as 'Date_Dépôt'
              ,[Type_Etude] as 'Type_Etude'
              ,[Dernier_Type] as 'Dernier_Type'
              ,[Eligibile] as 'Eligibilité'
              ,[Fiche_Information] as 'Fiche_Information'
              ,[Buletin_Adhesion] as 'Bulletin_d’adhésion'
              ,[Fiche_Renseignment] as 'Fiche_Renseignment'
              ,[Attestation] as 'Attestation'
              ,[Date_Debut] as 'Date_Début'
              ,[Date_Fin] as 'Date_Fin'
              ,[ID_Cabinet] as 'ID_Cabinet'
              ,[Montant_Demander] as 'Montant_Demander'
              ,[Duree] as 'Durée'
              ,[Porcentage_Taux] as 'Pourcentage,Taux' 
              from dbo.Dossier d inner join entreprise e on d.ID_Entreprise=e.ID_Entreprise
              where CNSS_Entreprise=@par and d.Nom_Giac=@nomgiac 
              end
            else if @nom='RS'  
              begin
              select [ID_Dossier] as 'ID_Dossier'
              ,[ID_Entreprise] as 'ID_Entreprise'
              ,[Date_Depot] as 'Date_Dépôt'
              ,[Type_Etude] as 'Type_Etude'
              ,[Dernier_Type] as 'Dernier_Type'
              ,[Eligibile] as 'Eligibilité'
              ,[Fiche_Information] as 'Fiche_Information'
              ,[Buletin_Adhesion] as 'Bulletin_d’adhésion'
              ,[Fiche_Renseignment] as 'Fiche_Renseignment'
              ,[Attestation] as 'Attestation'
              ,[Date_Debut] as 'Date_Début'
              ,[Date_Fin] as 'Date_Fin'
              ,[ID_Cabinet] as 'ID_Cabinet'
              ,[Montant_Demander] as 'Montant_Demander'
              ,[Duree] as 'Durée'
              ,[Porcentage_Taux] as 'Pourcentage,Taux'  
              from dbo.Dossier 
              where  Nom_Giac=@nomgiac and ID_Entreprise in( select ID_Entreprise
                                                             from dbo.Entreprise
                                                             where Raison_Social=@par)                                            
              end
           else if @nom ='Date'
            begin
             declare @v smalldatetime,@b smalldatetime
              set @b=SUBSTRING(@par,1,4)
              set @v=SUBSTRING(@par,5,8)
            select [ID_Dossier] as 'ID_Dossier'
              ,[ID_Entreprise] as 'ID_Entreprise'
              ,[Date_Depot] as 'Date_Dépôt'
              ,[Type_Etude] as 'Type_Etude'
              ,[Dernier_Type] as 'Dernier_Type'
              ,[Eligibile] as 'Eligibilité'
              ,[Fiche_Information] as 'Fiche_Information'
              ,[Buletin_Adhesion] as 'Bulletin_d’adhésion'
              ,[Fiche_Renseignment] as 'Fiche_Renseignment'
              ,[Attestation] as 'Attestation'
              ,[Date_Debut] as 'Date_Début'
              ,[Date_Fin] as 'Date_Fin'
              ,[ID_Cabinet] as 'ID_Cabinet'
              ,[Montant_Demander] as 'Montant_Demander'
              ,[Duree] as 'Durée'
              ,[Porcentage_Taux] as 'Pourcentage,Taux'  
            from Dossier 
            where Date_Depot between @b and @v and Nom_Giac like @nomgiac

            end 
            end

this is the search text and button :

 Saisir la CNSS : 
                     <asp:TextBox ID="CNSSTxt" class="TXTBOX" runat="server" Height="23px" placeholder="CNSS" style="font-family : Comic Sans MS, Arial, Tahoma; color:Red;"></asp:TextBox>

                     <asp:Button ID="BtnFiltrerCNSS" runat="server" Text="Filtrer" class="BTN" style="font-variant:small-caps;" />

this is the gridview :

 <div class="GridViewDiv">

              <asp:UpdatePanel ID="DossierUpdatePanel" runat="server" UpdateMode="Conditional" >
                  <ContentTemplate>
                      <asp:SqlDataSource ID="Dossier" runat="server" 
                              ConnectionString="<%$ ConnectionStrings:OfficeConnectionString %>" 
                              SelectCommand="AfficheDossiers" SelectCommandType="StoredProcedure">
                                   <SelectParameters>
                                       <asp:SessionParameter Name="Nom_GIAC" SessionField="Nom_GIAC" Type="String" />
                                   </SelectParameters>
                          </asp:SqlDataSource>

                      <asp:SqlDataSource ID="RechercheDossierDS" runat="server" 
                          ConnectionString="<%$ ConnectionStrings:OfficeConnectionString %>" 
                          SelectCommand="rechercherGIAC" SelectCommandType="StoredProcedure">
                          <SelectParameters>
                              <asp:SessionParameter Name="nomgiac" SessionField="Nom_GIAC" Type="String" />
                              <asp:ControlParameter ControlID="RecherhcerComboBox" Name="nom" 
                                  PropertyName="SelectedValue" Type="String" />
                              <asp:SessionParameter Name="par" SessionField="Recherche" Type="String" />
                          </SelectParameters>
                      </asp:SqlDataSource>
                      <asp:GridView ID="DossierGV" runat="server" AllowPaging="True" AllowSorting="True" 
          DataSourceID="Dossier" AutoGenerateColumns="False" DataKeyNames="ID_Dossier">
                          <Columns>
                              <asp:CommandField ShowSelectButton="True" />
                              <asp:BoundField DataField="ID_Dossier" HeaderText="ID_Dossier" ReadOnly="True" 
                                  SortExpression="ID_Dossier" />
                              <asp:BoundField DataField="ID_Entreprise" HeaderText="ID_Entreprise" 
                                  SortExpression="ID_Entreprise" />
                              <asp:BoundField DataField="Date_Dépôt" HeaderText="Date_Dépôt" 
                                  SortExpression="Date_Dépôt" />
                              <asp:BoundField DataField="Type_Etude" HeaderText="Type_Etude" 
                                  SortExpression="Type_Etude" />
                              <asp:BoundField DataField="Dernier_Type" HeaderText="Dernier_Type" 
                                  SortExpression="Dernier_Type" />
                              <asp:BoundField DataField="Eligibilité" HeaderText="Eligibilité" 
                                  SortExpression="Eligibilité" />
                              <asp:BoundField DataField="Fiche_Information" HeaderText="Fiche_Information" 
                                  SortExpression="Fiche_Information" />
                              <asp:BoundField DataField="Bulletin_d’adhésion" HeaderText="Bulletin_d’adhésion" 
                                  SortExpression="Bulletin_d’adhésion" />
                              <asp:BoundField DataField="Fiche_Renseignment" HeaderText="Fiche_Renseignment" 
                                  SortExpression="Fiche_Renseignment" />
                              <asp:BoundField DataField="Attestation" HeaderText="Attestation" 
                                  SortExpression="Attestation" />
                              <asp:BoundField DataField="Date_Début" HeaderText="Date_Début" 
                                  SortExpression="Date_Début" />
                              <asp:BoundField DataField="Date_Fin" HeaderText="Date_Fin" 
                                  SortExpression="Date_Fin" />
                              <asp:BoundField DataField="ID_Cabinet" HeaderText="ID_Cabinet" 
                                  SortExpression="ID_Cabinet" />
                              <asp:BoundField DataField="Montant_Demander" HeaderText="Montant_Demander" 
                                  SortExpression="Montant_Demander" />
                              <asp:BoundField DataField="Durée" HeaderText="Durée" SortExpression="Durée" />
                              <asp:BoundField DataField="Pourcentage,Taux" HeaderText="Pourcentage,Taux" 
                                  SortExpression="Pourcentage,Taux" />
                          </Columns>
                      </asp:GridView>
                  </ContentTemplate>
              </asp:UpdatePanel>
       </div>     

Any clues?

thanks,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T15:35:31+00:00Added an answer on June 4, 2026 at 3:35 pm

    In the onclick button event just set

    gridview.datasource = newDataSource;

    Then call the

    girdView.DataBind();

    Let me know if this is what you needed.

    If you are using visual studio 2010, you need to click on your .aspx file and then click design view in the bottom right of the window. This will load a mock up of your screen and you can just double click the button that you want the click event on. It will then redirect you to the code behind (.aspx.cs) file. In that method is where you need to write this.

    I only say this now because I see that your button has no onclick=”methodName” property

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a gridview with sqldatasource, etc. For the grid, I also have a
I have a ASP.NET Website, where, in a GridView item template, automatically populated by
Have a gridview control which will show X amount of rows. I want to
I have a GridView which I am populating by calling a method to return
I have a gridview that shows an image as part of one of its
I have a GridView what I fill through a LINQ expression. Something like this:
I have a gridview that displays items details, I added two template fields one
I have a gridview that is only shown in a modal popup. right before
I have a gridview and in that gridview i created a list of imagebuttons
I have a gridview inside an updatepanel. It has a TemplateField column with radiobutton:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.