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

Top 5 Contributors of the Month
Post New Web Links

How can I postpone a SqlDataSource lookup until after a user changes a dropdown

Posted By:      Posted Date: September 15, 2010    Points: 0   Category :ASP.Net
I have a form in which I am attempting to point to different connection strings based on a user dropdownlist selection after page load.  If I leave the connectionstring property undefined (and let it be populated by a switch on the .cs page's DropDownList1_SelectedIndexChanged call) it fails since the page DataSource runs on page load.  If I try pointing to a default connectionString and change from the drop down the connectionstring used on the aspx page always loads and the switch on the cs page fails to update a GridView.  How can I delay the call to the SqlDataSource but still load the page?  I have tried putting everything in the .cs page but that hasn't worked yet. 

View Complete Post

More Related Resource Links

Insert a "Select User" row in Linq for a dropdown list

I'm new to Linq. I have searched and searched the web for a soluion, and can't find anything. I have a Linq query and I want to insert a row ("Select User") to the top before I pass it to the drop down list. I've been trying to use the Union but to now avail (it keeps telling me that my object doesn't support the Union method). My code, prior to attempting to inser a row, is very simple.public SelectList DropDown_Users()        {            var context = new VivarianDataContext();            var query = from t in context.AspnetUsers                        select new { t.UserId, t.LastName };            list = new SelectList(query.AsEnumerable(), "UserId", "LastName");            return list;        }Now I try to insert a row and I found this on the internet and it seems to say that his solution will work. But it is filled with syntax errors. http://magicode.wordpress.com/2009/08/20/inserting-an-item-in-iqueryable-object-using-union-met

SPSecurityTokenService.PopulateOutputIdentity() failed to lookup UPN for user

Hello, I have a windows 7x64 developer box. On this I have installed SQL 2008R2 developer edition and Sharepoint 2010 ent. I run all the Sharepoint services under my local admin account "win7dh\administrator" When I enter a search term in the search box I get this error:   SPSecurityTokenService.PopulateOutputIdentity() failed to lookup UPN for user 'WIN7DH\Administrator': System.ComponentModel.Win32Exception: No mapping between account names and security IDs was done     at Microsoft.SharePoint.Win32.SPSecur32.GetUserNameEx(EXTENDED_NAME_FORMAT nameFormat)     at Microsoft.SharePoint.IdentityModel.SPSecurityTokenService.PopulateOutputIdentity(SPRequestInfo requestInfo, IClaimsIdentity outputIdentity)   I get this error in all site types.Can anyone tell me how to fix this issue? Thanks in advance Danny

User Profile Service lookup in dataview web part

I'm attempting to setup a web part in SharePoint Designer 2007 that will list team members that are currently on call.  I've created the data connection to our oncall database and a dataview web part that has two columns.  One column lists the users ID, and the other lists their oncall priority.  This part works great! Example: USERID  |   PRIORITY ID1234   |       1 ID5678   |       2 Now, what i would like to see instead is the user's name instead of their ID. Example: USERNAME  |   PRIORITY John, D       |       1        Jane, B       |       2 I thought originally i could pull this information from AD using the user profile service from here:  http://<servername>/_vti_bin/userprofileservice.asmx?wsdl I've created the data connection to the user profile service, but at this point, i'm unsure how to merge the two data connection columns and get the right user data to display. Any tips?  Has anyone done this before?

how to fill user control(.ascx) (Dropdown from Database)


i am created a user control(.ascx)

<span><asp:DropDownList ID="Drop_DocType" runat="server"  DataTextField="DOCTYPE"DataValueField="DOCTYPE"/></span>

  how to fill it rom database and where i put soure code

Lookup dropdown list > 20 items renders funny


On a MOSS site with the Publishing module enabled I'm experiencing some weird rendering issues with dropdown lists for Lookup fields in edit mode. When clicking the dropdown to select a value, the dropdown pops up somewhere entirely different on the page. I have googled this thoroughly but haven't really found any good solutions to this problem yet.
I understand that SharePoint changes how a dropdown is rendered when the number of items is more than 20, but I'm still hoping that this issue can be fixed in the masterpage and/or stylesheet?

Any thoughts and/or solutions?


User Profile property -- dropdown



Is it possible to create a user profile property (editable by user) with in a dropdown format?

Please advice. Thanks in advance

ssrs dropdown parameter with Week startDate and end date so that user selects only week and report s


Hi all,

I have a report where I have to show the Week start and end date in the dropdown instead of the date range. Please advice me how to proceed with this report parameter. Thanks a lot in advance, all help is appreciated.


How can I add "lookup manager of a user" to the default approval workflow


SPD 2010 with SharePoint server 2010. I have seen examples of how to use the "lookup manager of a user" action. Our SP user profiles have the manager field populated. I know how to copy the default approval workflow and I've tried my best to pick it apart - an effort to understand how it works. But I can't figure out how/where to insert a step to lookup the manager. 

We want the workflow to send a document to a staff member that they need to approve. We'll customize the email that fires to that staff member - easy. Once approved, we want the workflow to automatically route the document to the manager of that staff member for approval, and then close while notifying the initiator. This an effort to relieve the initiator from manual lookup of the manager to add in to the default approval workflow as an approver in series.

A relative novice to workflow, I believe I could piece together these steps in a new workflow. But I have no chance of including all the if/else steps that take into account due dates, approve/reject options, reassignments, etc. Hence the stab at customizing the built in approval.

MS SQL Server: Disconnect Users From Database - Kill User Session

If you ever wanted to restore your database from a SQL backup file (.bak), but there are still users connected to your database, the backup operation will fail causing the error: Exclusive access could not be obtained because the database is in use.

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

Dropdown list in ASP.NET - How to get value selected

am sure this must be very simple, but unforunately I can't figure it out.
I have the following code which populates the dropdown lists from the database. This works fine. Now, when the user selects a particular employee name from the list, I want to get the Employee Id of the selected employee. i.e. I need to get the "Eid" value. I can do this if the EId is loaded in the dropdown list, but in this case only the employee name is displayed. Please let me know howI can get the Eid value even though it is not loaded in the dropdown list.
I would really appreciate your help

Creating Sites/Lists/List Items under Current User Context in SharePoint By Using SPUserToken

Usually we do this by performing the action under RunWithElevatedPrivileges method and updating the listitem using SPListItem.SystemUpdate() method (see here). but this approach has its own flaws like (RunWithElevatedPrivileges will run under system account, we cannot use SystemUpdate for SPSite,SPWeb,SPList, since it runs under system we will "CreatedBy" by as SystemAccount).

How to track the changes of user contacts(colleagues) by using SharePoint API

We might have seen colleague tracker web part which keep tracks the changes made in our contacts/colleagues details like profile/lists/sites. The same tracking mechanism can be implemented by using MOSS API in any custom web part/ web control/ feature/web service...

UserProfile.GetColleagueChanges is the method which returns all changes happened with the contacts, this method also accepts a Query (UserProfileChangeQuery) where we can specify different parameters to filter the changes

Editable Gridview with Textbox, CheckBox, Radio Button and DropDown List

This is an example of an editable gridview containing different ASP.NET controls. When user wants to edit values in gridview, she/he can use these controls to edit existing values in Gridview Edit Mode.

Using the Code

Configuring User Profiles in SharePoint Server 2010

Note: I've added the necessary links relating to SharePoint Server 2010 prerequisites, along with instructions for configuring the user profile synchronization service, at the end of this

User Defined Functions in Microsoft SQL Server

User Defined Functions are compact pieces of Transact SQL code, which can accept parameters, and return either a value, or a table. They are saved as individual work units, and are created using standard SQL commands. Data transformation and reference value retrieval are common uses for functions. LEFT, the built in function for getting the left part of a string, and GETDATE, used for obtaining the current date and time, are two examples of function use. User Defined Functions enable the developer or DBA to create functions of their own, and save them inside SQL Server.

Binding an array to dropdown list


I have the following string which is a list of urls. How do I get this to work so the url shows for the selection and also is the value?      


allLinks = newAllLinks
        Me.DropDownList1.DataTextField = "Link"
        Me.DropDownList1.DataValueField = "LinkURL"
        Me.DropDownList1.Items.Insert(0, New ListItem(" - Select - ", 0))
        Me.DropDownList1.DataSource = allLinks


 ArgumentNullException: Value cannot be null.
Parameter name: container]
   System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName) +121
   System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName, String format) +8

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