.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

i have tested the same coding with dropDownlist but its working fine..I don't know why its not work

Posted By:      Posted Date: September 18, 2010    Points: 0   Category :ASP.Net
Dear Members,              I have used the following to bind the data from database into Ajax comboBox...but it's not working...             Actually i have tested the same coding with dropDownlist but its working fine..I don't know why its not working with Ajax ComboBox..          DropDownList Coding  private void LoadDropDownCatetory() { string connectionString = ConfigurationManager.AppSettings.Get("mcrmdb"); dropDownListTest.DataSource = ProductDataAccess.FillProductCategory(connectionString); dropDownListTest.DataTextField = "CATEGORY"; dropDownListTest.DataValueField = "CATEGORY"; dropDownListTest.DataBind(); } AjaxComboBox Codingprivate void LoadProdutCategory() { string connectionString = ConfigurationManager.AppSettings.Get("mcrmdb"); comboBoxProductCategory.DataSource = ProductDataAccess.FillProductCategory(connectionString); comboBoxProductCategory.DataTextField = "CATEGORY"; comboBoxProductCategory.DataValueField = "CATEGORY"; comboBoxProductCategory.DataBind(); } Design

View Complete Post

More Related Resource Links

Working with DropDownList and ListBox Controls in ASP.NET

"In my application i am using dropdownlist to display all categories from a table. When the user clicks this control I display all records in that category. Category table also contains column called color.

I wanted display some categories in dropdown list different color and others in different color using ASP.NET."-Anonymous

In sharepoint excel working fine in office 2007 but not in office 2010


Hi All,

we receive error  while trying to create excel sheet using the template we have uploaded on the SharePoint 2007.


This occurs on a machine that has Office 2010 installed. Earlier the machine had Office 2007 and everything was working fine.


Can you let me know why is problem is coming and how to resolve this.



Sanjeev Tiwari


Hi this method is working fine need filter how


private void GetData()
        for (int i = 0; i < Gridview1.Rows.Count; i++)
            DataView dv = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
            DataRowView drv = dv[i];

Web Part working fine on the top-level page but 'Not Safe' error on lower-level pages.


I have created a Web Part which reads and parses the SharePoint logs in order to display usage information of the page it resides on.  The Web Part works perfectly on the top page, reading and displaying the information desired.  However, once the Web Part is added to any page lower in the site heirarchy (sub-page) the same Web Part throws the following error:

Web Part Error: A Web Part or Web Form Control on this Page cannot be displayed or imported. The type could not be found or it is not registered as safe.

Show Error Details
Hide Error Details

[UnsafeControlException: A Web Part or Web Form Control on this Page cannot be displayed or imported. The type could not be found or it is not registered as safe.]
  at Microsoft.SharePoint.ApplicationRuntime.SafeControls.GetTypeFromGuid(Guid guid)
  at Microsoft.SharePoint.WebPartPages.SPWebPartManager.CreateWebPartsFromRowSetData(Boolean onlyInitializeClosedWebParts)

Of course the current version of the Web Part is in the SafeControls list on the web.config.

The Web Part was originally designed to return site activity only for the top default.aspx page and worked fine but started to fail in the manner described above once I added the following line of code to return a SPCo

DropDownList in Visual Studio 2010 - OnChangeEvent does not work


I am using code I have always used in other version of VS for binding to a list box.

After binding a dataset to a ListBox in VS 2010, render the page, and cilck any item in the list, the on change event always goes back to the first item in the list!  

The following code to run the list box runs once... 

if (!Page.IsPostBack)

DataSet ds = UWA.AWHWebServices.GetAllBranches();
LBCSC.DataSource = ds;
LBCSC.DataTextField = "BUSN_ROLE_NM";
LBCSC.DataValueField = "BUSN_ROLE_TYP_CD";

Now instead if I load the list box using Items.add, render the page, and then click on any item in the list I get the correct item selected.

for (int i=0;i<ds.Tables[0].Rows.Count; i++)

Is this a VS 2010 Bug? 


wpf datagridview checkbox column selection not working fine.

Hi Experts,in my c#.net windows based wpf application i added  a datagridview.dynamically i added checkboxcolumn to that datagridview DataGridViewCheckBoxColumn cbCol = new DataGridViewCheckBoxColumn(); GridSource.Columns.Add(cbCol); and another column is string. to this column am hardcoding the values DataTable _datatable = new DataTable(); _datatable.Columns.Add("Name", typeof(string)); _datatable.Rows.Add("CSRs"); _datatable.Rows.Add("Customers"); GridSource.DataSource = _datatable; till here fine am getting two columns (checkbox and Name)when i am trying to check those checkboxes problem comming.am trying to get the count of the checked rows for that i used below code int cbcount = 0; foreach (DataGridViewRow _dgRow in GridSource.Rows) { if ((bool)_dgRow.Cells[0].Value) cbcount++; } cbcount will give the checked count.but the problem raising here if i check 2 rows it giving 1if i check 5 rows it giving 4if i check 1 row it giving me 0means am getting n-1 resultwhere i did wrong??

Coding is not working for Making Password Field Encrypted in sql and using sessions .basically its a

Dim cn As SqlConnection         Dim cmd As SqlCommand         Dim dr As SqlDataReader         cn = New SqlConnection         cn.ConnectionString = ConfigurationManager.ConnectionStrings("fees_systemConnectionString").ToString         cn.Open()         cmd.Connection = cn         cmd.CommandType = CommandType.Text         Dim Hashpass As String = FormsAuthentication.HashPasswordForStoringInConfigFile(password.Text, "sha1")         cmd.CommandText = "Select * from login where username='" & Me.txtUsername.Text & "' and password = '" & Hashpass & "'"         Dim re As SqlDataReader = cmd.ExecuteReader()         If re.HasRows Then             While re.Read()                 Session("email_id") = re("username").ToString()                 Session("MemberType") = re("type").ToString()                 Session("ISLOGIN&

Missing DataContext! Was working fine, now it's hosed

So I have a web application, set up for .NET 4.0 ... I had a robust LINQ TO SQL Classes object, and it was running just fine. But I needed to make a schema change so I altered my database. No problem. Then I went into my .dbml file and deleted the table I had been working on. Then I re-added the table by dragging it from the server explorer. However, now my code is throwing a number of errors, all saying they can't find my DataContext, called ModelDataContext. I hadn't changed any other app code, so I am really confused!Error 3 The type or namespace name 'ModelDataContext' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Ed\Projects\NBAdminPanel\NBAdminPanel\WebApplication1\DynamicData\CustomPages\Accounts\Edit.aspx.cs 49 29 NBAdminPanel The type or namespace name 'ModelDataContext' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Ed\Projects\NBAdminPanel\NBAdminPanel\WebApplication1\DynamicData\CustomPages\Accounts\Edit.aspx.cs 49 29 NBAdminPanelSo basically my app no longer knows about the class generated from this DBML file. I have tried recreating it by deleting the old one and readding objects to the new one, no dice. I am at my wits end; hoping I don't have to junk the project and start a new one! My DBML file is still in MyProject.App_Code. 

Why sum function work fine in infopath and not in web browser

Hi,   I used the sum function in infopath, it work fine in infopath client, but the same open in web browser it not working correctly, it show the double the value. why it happen?

asp menu working fine in the dev environment but not on server

Hi guys,        I am sorry to be asking what is probably a really stupid question, but i have a problem with my asp menu, when i run it on my dev machine(thru vs2010) it works perfectly, all the menu's are displayed correctly with the correct child items in the correct order but when i publish it to the server all the menu items become flat and take up the whole page. I am populating the menu using a reentrant function as follows to call the function and add the menus i am using Dim childMenuItems As List(Of MenuItem) = CreateMenuLevel(0, uniquemenulist)childMenuItems.ForEach(Sub(n) NavigationMenu.Items.Add(n)) Public Function CreateMenuLevel(ByVal parentId As Integer, ByVal menulist As List(Of MenuList)) As List(Of MenuItem)        Dim menuItems As New List(Of MenuItem)        For Each menuListItem As MenuList In menulist.Where(Function(n) n.ParentId = parentId)            Dim MenuItem As New MenuItem            If (Not String.IsNullOrEmpty(menuListItem.PagePath)) Then                MenuItem.NavigateUrl = menuListItem.PagePath           

SqlClient Connection Works Fine with XP, will not work on Windows 7


Hello, I am programming in VS2010 wirting a simple windows forms program. I am using the System.data.SqlClient for a connection. My data Connection code:

'Used for reading data only



Public Function O

Help dynamic dropdownlist work on developer server but in production server not


 HI! I create a dynamic dropdownlist to select several values, in developer server it's everything ok but in production server, when the postback happens lost the selected value. Any idea?

AJAX DropDownList won't populate.. error500.. code is working though.


Here's what I have.  I was able to debug and traverse through the webservice and return teh array back into the first call method of: return new CarsService()..  But back in the page_load method, I can't get it to update and show up in the page.  what am I doing wrong?!?!


<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
                    <cc1:CascadingDropDown ID="CascadingDropDown1" runat="server" TargetControlID="DropDownList1"
                     Category="Make" PromptText="Please select a make" LoadingText="[Loading makes...]"  

Sorting function does not work fine -- Please help



          We have few SSRS 2008 reports.Some of the reports are plain simple table reports and few reports are grouped reports ( table reports). The issue is, sorting function works fine in simple reports whereas its not working good in the reports where grouping is involved. Could you please help me to resolve it?

Function not working in IE but work in all other browsers



I tested a JQuery function to create a Facebook like progress image. It works like a charm in all browsers (Chrome, Safari, Firefox, Opera) except IE8.

Any idea why?


    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('a').click(function (e) {
                var el = '';
                switch (e.target.text) {
                    case "Box 1":
                        el = '#box1';

Paging not working with two controls- Dropdownlist & Listview


So I am using EW + Access database to create a page.

This page contains two controls. First control is Dropdownlist which databinds with second control Listview.

This listview has paging on becuse of multiple pages. If I don't use QueryStringField paging works but if I use QueryStringField paging doesn't work and it goes back to first option of Dropdownlist.

I need paging to access specific records.

Can anybody help me with this issue.

Thx in advance!!

Cannot get OnClick, OnMouseOver, etc. functions to work in Firefox (but they work just fine in IE)


I am adding the following VB event handler code to my GridView's RowDataBound event:

If (e.Row.RowType = DataControlRowType.DataRow) Then
e.Row.Attributes.Add("onmouseover", "this.style.cursor='hand';this.style.textDecoration='underline';")
e.Row.Attributes.Add("onmouseout", "this.style.textDecoration='none';")
e.Row.Attributes.Add("onclick", ClientScript.GetPostBackClientHyperlink(Me.GridView1, "Select$" + e.Row.RowIndex.ToString()))
End If

This code works just fine in Internet Explorer, but not in Firefox. The If statement returns true, but none of the On... events get fired. What is blocking this in Firefox? 

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend