.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

Setting properties from a database

Posted By:      Posted Date: October 08, 2010    Points: 0   Category :ASP.Net

 I have a database which holds the path of an image. It also holds the recomended height and width of the image. My question is how can I set the height and width properties from my database? I have tried the following with no avail:

<asp:TemplateField HeaderText="Image" HeaderStyle-HorizontalAlign="Left">
                    <asp:Image ID="Image" runat="server" ImageUrl='<%# Eval("Image") %>'  Width='<%# Eval("Width") %>' Height='<%# Eval("Height") %>'/>


Any Ideas?

Thanks in advance

View Complete Post

More Related Resource Links

Advanced Basics: Setting Word Document Properties the Office 2007 Way


The last time I wrote this column (March 2006), I shared an application that allows you to update all the Microsoft® Word documents in a folder and its subfolders. Each time the application finds a document in the specified path, it updates the document properties to match those you specified in the application.

Ken Getz

MSDN Magazine June 2006

unable to attach database, security setting?


Hi folks,

I am using VS 2010 Professional with SQL Server 2008 Developer.  I right click on the App_Data folder in solution explorer and add an existing item, then navigate to the correct database.  However, I receive a pop up that Access is Denied.  How do I fix this? 

Change Database and Log Properties

Hello, I have the following T-SQL code when creating a database: create database DBFA on primary ( name = 'DBFA_Data', filename = 'DBFA_Data.mdf', size = 40MB, maxsize = 2GB, filegrowth = 20MB ), log on ( name = 'DBFA_Log', filename = 'DBFA_Log.ldf', size = 20MB, maxsize = 200MB, filegrowth = 10MB ) This is working fine when creating a new database. But how can I define this properties but on a existing database? Thanks, Miguel

setting a href value using javascript and server value from database

Hi Guys,I've been trying to set the href value of an anchor tag using it to do a javascript function, but also want it to have a database value... the whole page is to be called using the jquery .load method which is working fine... just want to get the link to work...here is the code so far for the whole page...<form id="form1" runat="server"> <div id="ajaxeditorspicks"> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:db639_55atcConnectionString %>" SelectCommand="SELECT TOP 3 * FROM [News] WHERE ([EditorsChoice] = @EditorsChoice) ORDER BY [ID] DESC"> <SelectParameters> <asp:Parameter DefaultValue="True" Name="EditorsChoice" Type="Boolean" /> </SelectParameters> </asp:SqlDataSource> <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1"> <ItemTemplate> <li><a href="#"> <asp:Image ID="image1" runat="server" ImageUrl='<%# Bind("imageurl") %>' AlternateText='<%# Bind("Title") %>' />

Styles: Setting Properties in deeper hierarchies


I'm not sure how to do a search on this, so I decided to rather ask it instead of doing hours of searching.

I have a class with DependencyProperties and use that class in a UserControl. I use that UserControl in a Window and in that Window I use the Window's Resources to set some Properties on the UserControl. I now like to set some DependencyProperties on that class, which would automatically reflect on the UserControl due the binding.

Is there a way to do it? I couldn't figure it out to do it in the .xaml, which is where I'd like to do this particular task.

how to find User Mapping option of database properties.



Good evenning all.

Can any body tell me how to find User Mapping option of any database

in sql server 2008.

so that i can change the DB_OWNER name to AdMINISTRATOR.

Thanks to all.

Setting Page properties from itself


Hi all,

Is there any easy way to set properties of a Page (or UserControl for that matter) from *within itself*?
As an example, I have several .aspx pages which inherit from exactly the same code-behind class, but I need to be able to pass different properties to the class to make them do the correct thing for the specific .aspx.

The only way I've found to do this is to create the following - which works fine, but doesn't feel right....
<script runat="server">
  Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
    Me.MyProperty = True
  End Sub

It would be a much nicer, simplier and easier solution to be able to be able to set MyProperty = True somewhere... is this possible?

The option of hard-coding properties within the class for the "parent" page is not going to work for my situation.

Many thanks in advance,
Tom Smile

Programmatically setting Agent Autostart properties


I've written a service to replace the SQL Server Agent service to be independent of Agent when moving to Express versions of SQL Server which do not include Agent.  Obviously on older 2000 MSDE versions I don't want Agent and my service running at the same time so I need to turn off Agent but there are SQL Server Properties such as under the General tab, "Autostart policies when the operating system starts" section and I need to uncheck the "Autostart SQL Server Agent".  In SQL Server Enterprize Manager I can right click the server then select properties and general tab.

How do I change that property either via T-SQL or via VB.NET to uncheck it?



Need Clarifications on SharePoint 2010 User Profile properties and Sync database security


Need few clarifications on SharePoint 2010 user profile sync. I’ve answered some of them but need confirmation/clarity on this front.

  1. Is there option to disable ‘email address’ import from AD?
    Yes. Can disable that property mapping.
  2. Possible to send mails (user alerts) from SharePoint without the user profile property ‘email address’ mapped?
    Yes. User alert mails from SharePoint will work without ‘email address’ mapped in user profile DB.
  3. In case email address too is imported into SharePoint, can we bulk export them from SharePoint? If Yes, how to security harden that database?
    Not Sure. I believe Farm admin account/sync account has access to do this profile DB.

 Thanks in advance for your advice.<

T-SQL for database size and space available (like on Database Properties page on SQL 2008 SSMS)


How can i (using T-SQL) get the database size and free space like the database properties page of SQL 2008 SSMS shows? I want to be able to display that information in our software.


Setting Up Database

I am trying to set up a database through my website using SQL Management Studio Express and after entering my database name and owner I am receiving error 262 stating that create database permission denied in database master

finding control id and setting properties in other pages


hi can anybody help me how to code,

im using a webusercontrol (hide.ascx) it has 2 buttons btn_hide,btn_expand

and in my other forms of all like(products.aspx)customers.aspx,orders.aspx

im using a panel conrol(pnl_products) where in im placing all the input controls.

i want to find the panel control in hide.ascx page and to set that

panel.visble=true/false property in this page.

so that expand and collapse the panel in each page.

Setting the value for MaximumSiteCount and WarningSiteCount for a content database gives error......


Hi i need to add the value for MaximumSiteCount and WarningSiteCount for a content database. When I tried to run it with SPSecurity.RunWithElevatedPrivileges(delegate().. it gives error  "Operation is not valid due to the current state of the object"......  and

when i run the code WITHOUT  SPSecurity.RunWithElevatedPrivileges(delegate()  am getting error ...Object reference not set to an instance of an object. while updating the contentdatabase at contentDB.Update();

any help would be highly appriciated..... thank in advance....

code is here any help will be appriciated.....





Setting "Reduce storage requirements for text properties by using a hash for comparison." using powe


Hey all,

I have a need to enable 'Reduce storage requirements for text properties by using a hash for comparison.' for a crawled property, i'd like to do this in my 'set search scopes' powershell script, where I define everything the crawler should be doing but I can't find the appropriate powershell command to do so, can anyone help?

At the moment I simply have one line setting up the property:


New-SPEnterpriseSearchMetadataManagedProperty -Name $preferredSandwich -SearchApplication $searchApp -Type 1  -RespectPriority 1 
-FullTextQueriable  1 -Retrievable 1 -IncludeinMd5 1	


Setting up 2 node Active-Active SQL cluster as High availability and database mirroring at database

Hi guys
Please need your inputs and suggestions. I have always worked as junior DBA and have setup the HA but never planned for it. Please need some support here.

We have one main application: Application1 ...which is the sending data to all other application for billing, reporting, processing the orders and other stuff. This application is working right now on two Server.

Server1:  SQL Server 2005 Enterprise Edition  (Total 16 Gb RAM , SQL Server ( 4-12 GB AWE Enabled) and  2Processors (4 core each) and 836 GB of HD )

Setting Windows Services App properties programatically


I've got a Windows Services app I've deployed and I've used the System.ServiceProcess.ServiceInstaller to set the StartType to Automatic and that works great.

How do I set the action on failure to "restart" and the wait time to one minute?

Can't find those properties but if you open up a Service's properties in the UI, there's a Recovery Tab with First Failure, Second Failure etc. and a "Restart service after __ minutes"

Where do I set these properties for my service at design time before deploying??



Setting ShowInDisplayForm, ShowInEditForm, ShowInNewForm properties with powershell


I am trying to set ShowInDisplayForm, ShowInEditForm, ShowInNewForm properties of the filed in a custom list using powershell. This looks straightforward and powershell code is quite simple:

#get the site
$site = new-object Microsoft.SharePoint.SPSite("http://sv42104bosv271")
$web = $site.OpenWeb()
#get the list
$list = $web.Lists["MyList"]
#set col1
$field = $list.Fields["col1"]
$field.ShowInNewForm = "false"
$field.ShowInEditForm = "false"
$field.ShowInDisplayForm = "false"
#set col2
$field = $list.Fields["col2"]
$field.ShowInNewForm = "false"
$field.ShowInEditForm = "false"
$field.ShowInDisplayForm = "false"
#update & dispose

This runs without any error messages in “SharePoint 2010 Management Shell”, but the expected behavior is not being applied. I have also done an iisreset, but still col1 and col2 remain visible in all 3 forms...

Has anyone have a suggestion on this?

Thanks in advance!


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