Forms Data Controls :: Setting Properties From A Database?
Oct 4, 2010
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:
[Code]....
View 6 Replies
Similar Messages:
Mar 11, 2011
eI am using themes to set the Gridview font size and font name. I need to set the boundfield to the same font and size as I want it to be application to all the columns in gridview. How can I specify the boundfield properties in the themes.
View 8 Replies
Jan 7, 2010
I am in need of some assistance in regards to how to best set the values of properties for a Web User Control which is being included into a cell of a GridView with dynamically created columns. I have tried a few different approaches, but can't seem to get a satisfactory result. Also, to be completely honest, I am not really sure if I am using best practices for what I am trying to accomplish.
First off a little background:I have a GridView for which we will never know the exact number of columns at run time. The columns are predicated by user selection. I am creating the command text for the DataSet on the fly and then looping through the columns of the resulting DataTable in order to use custom TemplateFields. This works ok for just printing out the row values but not so much for when I need to insert the Web User Control into a cell.The Web User Control is in essence a collection of image links which are used as a "Quick Nav" tool. I need to pass the values of 2 fields from each DataRow to the control via properties (for example, CustID and ProductID). I am using custom TemplateField classes inheriting from ITemplate for displaying my fields and extending the DataBinding event like so: [Code]....
This won't work for my User Control as DataBinding is called after the control is loaded into the page and I need the properties to be set before the Page_Load event of the control is fired.Is there a GridView event I should be looking into instead such as RowCreated or RowDataBound? Or should I modify how I loop through the DataTable by doing rows first, then the resulting columns as I've seen done elsewhere?
View 5 Replies
Nov 7, 2010
In my ASP.NET application I am using a lot of ObjectDataSource controls. I want to set the following three properties globally for all ObjectDataSource controls:
EnableCaching="true"
View 5 Replies
Dec 23, 2010
I try to set the selection in the radiobuttonlist accordingly to data retrieved from the database.
This is not working (the mydata.gender contains "Mail")
mygender = myfatality.gender
View 2 Replies
Oct 8, 2010
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
</script>
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.
View 2 Replies
Jan 15, 2010
i have a WebControl class called ContentFrame that has a Header property and a Content property.
public WebControl Header {get; set;}
public WebControl Content {get; set;}
Now let's say that I have form x and ContentFrame is on the form. What I want to do is be able to set the the Header and Content properties during design time in the source
<cc1:ContentFrame ID="ContentFrame1" runat="server">
<Header>
<WebControl></WebControl>
</Header>
<Content>
<WebControl></WebControl>
</Content>
</cc1:ContentFrame>
View 5 Replies
Jan 6, 2011
hyperlink in new windows and setting properties
View 1 Replies
Dec 15, 2010
I have some user controls which have properties which need to be set from a form on the page
<uc1:MyPlugin
ID="MyPlugin2"
runat="server"
Property1="Hi"
Property2="0" Property3="<%=Property3%>"
Property4="<%#Property4
%>"
/>
Property3 and Property4 anre both public properties of the page I am on and the user control
Currently the code complaing about Property3 saying it cannot create an object of Int32 from '<%=Property3%>' and Property4 always gets set to 0 (the default)
I do not wish to use the c# code to set these values as this Plugin will be deployed with a CMS which I have no control over
View 3 Replies
Jan 11, 2010
We are trying to use a BasePage class (which inherits from Page) to populate and set the Meta Keywords and Meta Description Tags. I am using masterpages and below is an example code extract... According to examples on the internet, I could then set this also via the Page Directive using the MetaKeywords and MetaDescription properties, but they do not appear.
I have tried setting the CodeFileBaseClass="MyNamespace.UI.BasePage" but this does not work either. Using debug I can see that the BasePage classes' MetaKeywords and MetaDescription properties are not being set within my content page. I can access the properties but not set them.
== BASEPAGE CLASS ==
[Code]....
== PAGE CLASS ==
[Code]....
View 3 Replies
Jan 25, 2011
I have a user control (i.e. ascx) that comprises of two related list boxes (i.e. once you change the selected item in one list the contents of the other list update). I'm adding this user control dynamically to a page on the click event of a button (i.e. using LoadControl).I wish to set the list box datasource properties, as well as the default selected item of the parent list from my parent page so I created public properties in my user control to accomodate this. I also created an event in my user control that notifes the parent page when the selected item changes in one of the list boxes so I can update the contents of the other list box.
I understand that I have to recreate the user control on every postback in order for it to function correctly but I'm not sure exactly how I should be doing it. I've shown below what I have currently - whilst it works the problem is that on postback I'm always creating the user control with all its default properties and then updating the properties that need to change(?). For example, when the choice in theparent list box changes the datasource of the list box is set twice (once in AddControl and then again in OnParentChanged)? As the contents of the list boxes originate in a database it means I'm making unnecessary calls to the database (unless I do some something like store each unique set of data in the ViewState).
I'd be very grateful if someone could review how I've done things and illustrate how perhaps I should be doing things. I'm not sure if the way I've done this is considered the 'correct' way. For example there may be a better way of doing things would avoid setting the properties twice? I'm a bit unsure of the way I've set the datasource properties of the list boxes and bound them. I wished to set the datasource from the parent page because I might have a second user control on my page that may also use the same datasource and I could reuse it (as opposed to each control making its own call to the database) so I'd like to keep this feature if possible.It would be great if posting code in reply that you use my example as a guide so I know what you're referring to.Here's the code for my user control:
[Code]....
[Code]....
Here's the code for my containing page:
[Code]....
View 1 Replies
Oct 23, 2010
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.
View 2 Replies
Jan 6, 2010
[Code]....
Once the template is loaded and cast back to the TabHeader class, it's null. How can I load that control, set the properties, and use it as the template? Or is the only way to go about doing this to create a custom class?
View 2 Replies
Feb 4, 2010
Some settings in asp.net like viewstate can be controlled at the site (web.config), page, or control levels. What is the order of precedence? What happens, for example, if I set viewstate of site and page levels but on at the control level?
Also, is viewstate for a control the same as control state? Furthermore, what events to use for loading and saving viewstate for controls (is this the same thing as control state?) and also for custom controls?
Similarly, which events should I use to render controls? Is this PreInit and Load? Is this the same for custom controls?
View 1 Replies
Dec 6, 2010
I have the following property:
[Code]....
I want to be able to have the user see the available options when they try to do something such as DateRange = .... (i want intelllisense in here and I can set the values). Is this a possible functionality? I am using VS 2008 .NET 3.5
View 1 Replies
Apr 20, 2010
I though it would be very simple but I can not get it today.I have a user control, with a grid control contained in it.
public Unit Width
{
get
[code]...
View 1 Replies
Nov 9, 2010
Regarding these two approaches:
<asp:Label ID="Label1" runat="server"><%# DateTime.Now %></asp:Label>
and
Label1.Text = DateTime.Now.ToString();
Which do you use and why?
View 2 Replies
Mar 16, 2011
I have a DetailsView which has two fields - one that is visible, one that is not. The first the user fills out, the second I want to auto-populate. Unfortunately, I haven't been able to find a way to set the value in this second invisible field. I've tried adding code like this to the Page_Load:
If Not IsPostBack Then
DetailsView1.DefaultMode = DetailsViewMode.Insert
Dim txt1 As TextBox = DirectCast(DetailsView1.FindControl("Type"), TextBox)
txt1.Text = "administrator"
End If
But this returns an error of "Object reference not set to an instance of an object." how to accomplish this - either using the method above or another method? The hoped for end result is that when a new record is inserted via the DetailsView that this record will include the username (entered by the user) as well as the "type" of "administrator"
View 2 Replies
Jan 19, 2010
we are working on some utilities to provide the webmaster, one of which needs to search the properties of the webparts on a page for certain string values. So I want to desterilize the blob into the object graph and
iterate through the properties.
View 1 Replies
Nov 3, 2010
Probably a Q more suited for a SQL forum, but I guess it comes up a fair bit in ASP.net web site design?
View 5 Replies
Jul 27, 2010
I have a table created during runtime, how can I set its properties such as border width, width, v-align and etc?
View 6 Replies
Jun 23, 2010
I got this at my page design. How can I set those properties at runtime?
[Code]....
I am able to do it for these properties,
[Code]....
But I do not know how to do it for BorderStyle, OnDataBound, Font-Name.
The most important item is the OnDataBound.
View 2 Replies
Mar 25, 2011
I have a FormView bound to an ObjectDataSource that is bound to a business logic object. The business logic object has a Readonly field called "Id". When I try to update the formview, I get the following error message: The 'Id' property on the type specified by the DataObjectTypeName property in ObjectDataSource 'ObjectDataSourceNewsArticle' is readonly and its value cannot be set. How do I get the ObjectDataSource or the FormView to recognise that the id field is readonly, and to not try to update it?
View 3 Replies
Sep 10, 2010
At the outset i would like to welcome all as this is my first post on this forum :)probably i've got a simple problem for most of you, namly:I want to dynamically replace ImageUrl into DadaGrid cell. I've already prepare a right type of field (Image Field) and this is my code:
[Code]....
And i.ve got this error:Specified argument was out of the range of valid values.Parameter name: index
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.Parameter name: indexSource Error:
[Code]....
If any one has an idea about what i'm doing wrong?
View 4 Replies
Dec 25, 2010
I have a repeater control which looks like so: (Trimed it to show the essentials)
[Code]....
And i have a class which looks like so:
[Code]....
Is there anyways i can use the class properties to populate the repeater control? Probably modify the class or something?
View 1 Replies