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


Top 5 Contributors of the Month
david stephan
Santhakumar Munuswamy
Asad Ali
Fauzul Azmi
Post New Web Links

ASP.NET DropDownList Web Control, Part 1

Posted By: Venkat     Posted Date: February 13, 2010    Points: 2   Category :ASP.Net
 
Anybody with much experience in ASP has written an include file function for populating the contents of a SELECT dropdown list with entries from a database. Some of the more advanced users have even gone so far as to add caching to their function to reduce database hits for these rarely changing menu options. Naturally, these same techniques are going to be used with ASP.NET, but with a new programming object model. ASP.NET provides a web control, the DropDownList, which can be used for the same purposes as our custom built SELECT tag from Classic ASP.


View Complete Post


More Related Resource Links

Choosing Between a User Control or Web Part for SharePoint

  
SharePoint will only display Web Parts on a page. However, there are publicly available shims that allow you to write user controls and have them be displayed as a Web Part. From SharePoint's point of view, the shim is a Web Part. From the point of view of the user control, the shim is simply a control in .NET that is including the user control

Can't Find DropDownList In Control Parameter

  
I have a page with 2 Content Controls. Content1 has a SqlDataSource with a Control Parameter
that uses a Dropdown list. The dropdownlist is in Content2. I used viewsource to get
the dropdownlist control name which was
ctl00_ContentPlaceHolder6_ddlPersonFilter. I also got an error if I used ddlPersonFilter.
 
Thanks for any assistance.

Could not find control 'ctl00_ContentPlaceHolder6_ddlPersonFilter' in ControlParameter ''.

 
<%@ Page Title="Deal ToDos" Language="VB" MasterPageFile="~/Protected/secureds_deal.master" 
                            AutoEventWireup="false" 
                            EnableViewState="true"
                            CodeFile="DealToDos.aspx.vb" 
                            Inherits="Protected_DealToDos"
                            EnableTheming="true" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ MasterType 

Dropdownlist as user control

  
HiIn an inventory application am using a dropdownlist for selecting the customer.So the customer names are populating from the database table(sql ie setting datasource). Now  I  think its better to create the dropdownlist as a usercontrol in asp.net so that i can just drag the customer dropdownlist to every page .Also i have to get the selected index change event and many more events.Can we achieve that?If so How. plz share the sample code.Thanks in advance

Accessing a row's dropdownlist values AFTER the gridview control is in Edit mode

  
Hello, I have a gridview control. When it goes into Edit mode, there are 3 dropdownlists in one cell that are populated by separate stored procedures during the RowDataBound event. The 1st dropdownlist's value is used as a parameter to determine what the 2nd dropdownlist is populated with. The 2nd dropdownlist's value is used as a parameter to determine what the 3rd dropdownlist is populated with. Everything works fine when the row is first put into Edit mode. While I'm in Edit mode and I change the selection in the 1st dropdownlist, how do I access the control so I can feed this new parameter to the 2nd dropdownlist? I have the first 2 dropdownlists set for AutoPostBack so that the Page_Load event is fired when the user changes a value. I know how to get access to these controls via the FindControl method when the row is being databound but how do I find the control during the Page_Load event? Thanks for any help!!!   Penny  

How to Fire events on SharePoint DateTime Control in visual web part

  
Hi All, I am working on visual webpart of SharePoint 2010. I am using a <SharePoint:DateTimeControl> i m trying  to fire OnDateChanged event on it. I am not getting the Appropriate way to create the event. please help me out!!!!   void ToDate_OnDateChanged(object sender, EventArgs e)         {                         if (ToDate != null)             {                 DateTime min = Convert.ToDateTime(FromDate.SelectedDate.ToString());                 DateTime max = Convert.ToDateTime(ToDate.SelectedDate.ToString());                 int noofdays = Convert.ToInt32((max - min).TotalDays);                 txtNoOfDays.Text = noofdays.ToString();             }         }    <SharePoint:DateTimeControl runat="server" Calendar="Gregorian"  

Closer look at GridView control (Part 1)

  
Normal 0 false false false MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} Normal 0 false false false MicrosoftInternetExplorer4 Normal 0 false false false MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} You may wonder that why I have chosen topic on GridView control, when there are lot of material available on internet for GridView. But this article focus on closer look on GridView control,

Need help understanding dropdownlist within a repeater control

  

Asp.net 3.5 using code behind

I am using a repeater control. My datasource appears in code behind. I decided to NOT have my listitems populate from the database. I want the user to select a value, send it to the database via an update statement, and then when the user returns to the page (on pageload), have the user's previous selections appear on the screen.

 Please note the following:

  • When I use textboxes and labels, ALL of my data appears within the table of the repeater control. However, when I replaced one of the text boxes (originally used for testing purposes only) with a dropdownlist, I get the following error message 'ddlDDuring' has a SelectedValue which is invalid because it does not exist in the list of items.Parameter name: value
  • My Repeater1_ItemCommandI updates the data within the repeater perfectly.
  • On page load, I want the data from the database to display as the dropdownlist's selected value (or selected item.text).  

 Here is my Asp code

 <asp:Repeater ID="Repeater1" runat="server" 

                         onitemcommand="Repeater1_ItemCommand">

---

<

td><

User Control Web Part - The type initializer for 'IBM.Data.DB2.DB2Connection' threw an exception.

  

Hello,

I need help, in our SharePoint 2007 project we have created Web Part using VS 2005 & .Net 2.0, User Control. In the user control for one of the drop down list box databinding method we are using data from IBM DB2. It works fine on our local machine, but after Web Part deployment if i open the page then the Drop Down List is empty. I checked the log in the event viewer. I found the following error message in the vent viewer -

The type initializer for 'IBM.Data.DB2.DB2Connection' threw an exception.

 

Detail Error Message -

An unhandled exception occurred and the process was terminated.

Application ID: /LM/W3SVC/2076212728/Root

Process ID: 26880

Exception: System.TypeInitializationException

Message: The type initializer for 'IBM.Data.DB2.DB2Connection' threw an exception.

StackTrace: at IBM.Data.DB2.DB2Connection.Finalize()

InnerException: System.InvalidOperationException

Message: SQL1159 Initialization error with DB2 .NET Data Provider, reason code 7, tokens 9.1.1.DEF.2, SOFTWARE\IBM\DB2\InstalledCopies

StackTrace: at IBM.Data.DB2.y.f.a()

at IBM.Data.DB2.DB2ConnPool.g()

at IBM.Data.DB2.DB2ConnPool..ctor()

at IBM.Data.DB2.DB2Connection..cctor()

For more information, see Help and Support Center at h

Prevent mousedown raise in disabled part of control which is outside control boundary

  

Hi,

I have a control that is located onto a window in my example. that control contains something that is shown, but the user may not be able to click onto the area (here red colored) to select it. Only by clicking on the black part should select the control.
I disabled the red part, but still the mousedown is fired in the control. I would expect that the mousedown would be raised in the background of the window and not in the control.
Event when the Red part is made transparent, the event is fired inside the control (BUG???)

Is there a way to prevent that when the red part is clicked, the control raises the mousedown.
I simplified the example.

<Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525" MouseDown="Background_MouseDown">
  <Grid  HorizontalAlignment="Left" VerticalAlignment="Top" >
    <Canvas MouseDown="Control_mouseDown" Width="100" Height="100" HorizontalAlignment="Left" VerticalAlignment="Top"  Background="Black" >

How to add a sub-list to dropdownlist control

  

Hi

I have question about dropdownlist control.


I have a dromdownlist control which shows the list of dealers. I want to
add a sub-list to each dealer which should populate the products available at
that particular dealership. I don't want to select value from sub-list. Just want to display.

Thanks alot

Regards



Accessing the selected value of a dropdownlist control in a Form View

  

I need to verify the selection in a dropdown list control is not a certain value.  It is in the edit mode of a formview.

just to verify that I could access it I tried to put the value in a label,  however it is always empty:

 

this is what I used

  'Dim droplist5 As DropDownList = DirectCast(FormView1.Row.FindControl("DropDownList5"), DropDownList)

 

            LabelHeaderwarning.Text = droplist5.SelectedValue.ToString

 

I also tried the validation controls but they don't seem to work with a drop down control.

 

Any suggestions on this would be extremely helpful

 

Thanks


Ajax, Smart Parts(web part w/ ajax support), User Control, and a GridView

  

So I am playing around with a user control that I created that adds some functionality to a SPList. I have scoured the web looking for a way to get a web part that had a gridview with custom buttons that is bound to certain Items in a sharepoint list. I found Smart Parts and created an Ajax enabled User Control. the problem is that the label is updating but the gridview is not. and on a site note how can I format the Time on Board column to not include milliseconds(the fields are showing up like '1.02:48:31.8633636') i just want 1.02:48 and maybe the 31:

here is my ascx:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AlertControlWebPart.ascx.cs"
  Inherits="AlertControlWebPart.AlertControlWebPart, AlertControlWebPart, Version=1.0.0.0, Culture=neutral, PublicKeyToke

Get context to a control in web part from visual user control

  

I have a Visual Web Part (lets call it "ABCWebPart").

I'm attempting to create a connection to another web part which means I have to create the ConnectionProvider in the WebPart class (ABCWebPart.cs).

The value I want to set in my AJAX provider interface is a control I created in my visual user control (ABCWebPartUserControl.ascx).

How do I get the context of the TextBox control from my Visual user Control in order to assign it's value into the AJAX provider interface?

 

Thanks in advance,

- Eric


how to create dropdownlist user control(acsx) and fill from database

  


how to create dropdownlist user control(acsx) and fill from database


Create asp Hyperlink control dynamically in web part

  

Hi all,

I am now writing a customized Web Part to list out all the documents in a document library and I use an ASP 'Hyperlink' control for each document item.

The problem is, the number of Hyperlink controls depends on the number of documents and should be created dynamically. My approach is the hyperlinks will be generated after the user clicked a button in the web part.

So I would like to ask how can I generate those Hyperlinks dynamically at run time(the user clicks the web part button)?

Thanks!


Categories: 
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