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 8160521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:16:04+00:00 2026-06-06T18:16:04+00:00

I have two cascading dropdowns and one gridview control. on page load iam binding

  • 0

I have two cascading dropdowns and one gridview control. on page load iam binding gridview,
when i click on particular row iam trying to fill cascading dropdowns in Rowcommand event.
aspx code

<asp:DropDownList ID="txttechnology" runat="server" ClientIDMode="Static" Font-Size="8pt"
                        Width="155px" TabIndex="7">
                    </asp:DropDownList>
                    <asp:CascadingDropDown ID="CascadingDropDown1" runat="server" TargetControlID="txttechnology" ClientIDMode="Static"
                        Category="Make" PromptText="Select Technology" ServicePath="~/google.asmx" ServiceMethod="GetTechnology" SelectedValue=""/>

<asp:DropDownList ID="txtprimaryskills" runat="server" ClientIDMode="Static" Font-Size="8pt"
                        Width="155px" TabIndex="8">
                    </asp:DropDownList>
                    <asp:CascadingDropDown ID="CascadingDropDown2" runat="server" TargetControlID="txtprimaryskills" ClientIDMode="Static"
                        ParentControlID="txttechnology" PromptText="Select Skill" ServiceMethod="GetSkill"
                        ServicePath="~/google.asmx" Category="Model" SelectedValue="" />

row command event code

int type = convert.toint32(e.commandargument.tostring());
 cascadingdropdown1.selectedvalue =grdindirectconsultant.rows[type].cells[2].text.tostring().trim();
cascadingdropdown2.selectedvalue = grdindirectconsultant.rows[type].cells[3].text.tostring().trim();

web service methods

 [WebMethod]
    public CascadingDropDownNameValue[] GetTechnology(string knownCategoryValues,string category)
    {
        List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();
        try
        {           
            DataSet makes = SqlHelper.ExecuteDataset(LITRMSConnection, "usp_getskills");
            for (int i = 0; i < makes.Tables[0].Rows.Count; i++)
            {
                string make = makes.Tables[0].Rows[i]["Technology"].ToString();
                string makeId = makes.Tables[0].Rows[i]["ID"].ToString();
                values.Add(new CascadingDropDownNameValue(make, makeId));
            }
        }
        catch (Exception ex)
        {

        }
        return values.ToArray();
    }
    [WebMethod]
      public CascadingDropDownNameValue[] GetSkill(string knownCategoryValues, string category)
      {
          List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();
          try
          {
              System.Collections.Specialized.StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);
              int makeId;
              if (!kv.ContainsKey("Make") || !Int32.TryParse(kv["Make"], out makeId))
              {
                  return null;
              }             
              DataSet models = SqlHelper.ExecuteDataset(LITRMSConnection, "usp_GetSkillsList", new SqlParameter("@technology", makeId));
              for (int i = 0; i < models.Tables[0].Rows.Count; i++)
              {
                  values.Add(new CascadingDropDownNameValue(models.Tables[0].Rows[i]["Skill"].ToString(), models.Tables[0].Rows[i]["Technology"].ToString() + "," + models.Tables[0].Rows[i]["SkillID"].ToString()));
              }
          }
          catch (Exception ex)
          {

          }
        return values.ToArray();
      }
 i am getting values in to cascadingdropdown1 & cascadingdropdown2  but not able to set(selected Value) value in cascadingdropdown2.

i found one reason is after binding in rowcommand it is going to Getskills().
How to prevent calling Getskills().

  • 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-06T18:16:05+00:00Added an answer on June 6, 2026 at 6:16 pm

    HiI can findout the answer, remove the CascadingDropDown2 selectedValue Propery and write the row command event Code

    int type = Convert.ToInt32(e.CommandArgument.ToString());
                        Label filename = (Label)grdindirectconsultant.Rows[type].Cells[1].FindControl("lblresume");
                        string txtfile = grdindirectconsultant.Rows[type].Cells[1].Text.ToString();
                        CascadingDropDown1.SelectedValue = grdindirectconsultant.Rows[type].Cells[8].Text.ToString();
    
                        txttechnology.SelectedItem.Value = grdindirectconsultant.Rows[type].Cells[8].Text.ToString();
                        Fillskills(); //Fill the primary skills depended up on the technology
                        CascadingDropDown2.SelectedValue = grdindirectconsultant.Rows[type].Cells[8].Text.ToString() + "," + grdindirectconsultant.Rows[type].Cells[9].Text.ToString();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created an user control for cascading two dropdownlists province and city. But
Have two actionsheet buttons and one modalviewcontroller on mainviewcontroller in application. Now for two
I have two classes (MVC view model) which inherits from one abstract base class.
I have two update panels on a page. And I want to update both
I have two tables inside a database. One stores unique userNames and a unique
I have two very similar .aspx pages. Both of them contain a DropDownList control.
I have two tables: invoices & invoice_items. I need a one to many relationship
Have two sets of data (two tables) for patient records, one 1999-2003, the other
Have two issues one is showFromToolbar statement format warning issue and another is that
I have cascading data-bound combo boxes, however, if the second of the two boxes

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.