Web Forms :: Change Css Classname At Runtime In C#?
Jan 12, 2010How to change the css classname of <div> tag at runtime in c#?
View 6 RepliesHow to change the css classname of <div> tag at runtime in c#?
View 6 RepliesIn my website1, I posted some data to my website2 by doing an HttpWebRequest.The data are posted successfully but what I wanna do is change the imageUrl in website2 after website1 fired some data. When I try to debug, I can see that it passes through the code of changing the ImageUrl, but when I view the source of website2, I can't see the imageUrl being change at all... Does anyone have a clue?
View 3 Repliesi m using embed tag for displaying video file.i want to change file in src attribute of embed tag runtime when i click on button.how can i access embed tag in my .cs file .
View 2 Repliesone of my client has the requirement of changing the latest news section of website dynamically or runtime so not to publish the site and host it agian and again.this section is in master page how can i achieve this in asp.net c#
View 4 RepliesHow can I change a parameter to a web part at runtime?
View 1 RepliesCan I change the applicaiton virtual path at the runtime
View 1 RepliesDoes anyone has an idea on how to change the connection string of the webparts at runtime. i have a multitenant app, and would like to store each accounts users settings in their respective DB's i tried changing the connstring in the webpartsmanager init, and the page load event
Dim myConfiguration As System.Configuration.Configuration = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~")
Can we change master page dynamically in ASP.NET ... If yes How?
View 1 RepliesI'm using the mvc authorize attribute on my controllers. Using forms authentication, I'd like to be able to redirect unauthenticated users to a different loginUrl based on the route or target url. I'm guessing that creating my own authorize atribute isn't the right thing to do because it shouldn't know about the authentication module you are using (Windows/Forms etc). What would be a good way to acheive this?
View 2 RepliesI have a formview bound to an entitydatsource and it is working fine. here's the scenario though
If the querystring contains a "memberID" , I have setup an object datasource to fetch the results corresponding to the memberid from the database.
I want the name and email id fields in the formview to default to these values in the objectdatasource. How can you do this?
My issue is that , need to change the column name(following some format) of the gridview (which is binded with XMLTextReader). Without changing directly XML file, Required to change the column name dynamically at runtime .
Performance.xml
<Performance>
<Departments>
<Heading>FS</Heading>
<S0015>1</S0015>
<S0020>2</S0020>
<S0025>5</S0025>
<S0030>5</S0030>
<S0035>6</S0035>
</Departments>
<Departments>
<Heading>BS</Heading>
<S0015>0</S0015>
<S0020>3</S0020>
<S0025>5</S0025>
<S0030>1</S0030>
<S0035>3</S0035>
</Departments>
</Performance>
Heading S0015 S0020 S0025 S0030 S0035
FS 1 2 4 5 6
BS 0 3 5 1 3
Required Format:
Heading 00:15 00:20 00:25 00:30 00:35
FS 1 2 4 5 6
BS 0 3 5 1 3
I tried this link but I wonder is it possible doing the same thing without page refresh?
View 1 RepliesIs it possible to change the ascx file used by a usercontrol at runtime?
For example in my page i have
<ctl:SampleControl runat="server" />
in the web.config I have
<controls>
<add tagPrefix="ctl" tagName="SampleControl" src="~/UserControls/SampleControl.ascx" />
</controls>
At runtime I would like to be able to change the ascx to another path, it would still be inheriting from the same usercontrol codebehind, it would just be a different template.
I'm filling a previously created DataGridView on an ASP.NET Web Form dynamically with a DataTable, but I want to change the name of the columns that appear on that DataGridView, and I simply can't figure out what I'm doing wrong. Below is the code:
DataTable dtUsuarios = DBManager.RunSqlGetDataTable(
@"select b.UserName, c.Email, c.IsLockedOut, c.LastLoginDate,
case
when e.RoleName is not null then 1
else 0 end Admin
from dbo.aspnet_Applications a join dbo.aspnet_Users b
on a.ApplicationId = b.ApplicationId
join dbo.aspnet_Membership c
on b.ApplicationId = c.ApplicationId
and b.UserId = c.UserId
left join dbo.aspnet_UsersInRoles d
on d.UserId = b.UserId
left join dbo.aspnet_Roles e
on d.RoleId = e.RoleId
where a.ApplicationName = 'Mont Blanc Catalogo'");
dtUsuarios.Columns["UserName"].Caption = "Nome Usuário";
dtUsuarios.Columns["Email"].Caption = "E-mail";
dtUsuarios.Columns["IsLockedOut"].Caption = "Bloqueado";
dtUsuarios.Columns["LastLoginDate"].Caption = "Último Login";
dtUsuarios.Columns["Admin"].Caption = "Administrador";
DataView dvUsuarios = new DataView(dtUsuarios) { Sort = "UserName" };
gdvUsuarios.DataSource = dvUsuarios;
gdvUsuarios.DataBind();
//gdvUsuarios.Columns[0].HeaderText = "Nome Usuário";
//gdvUsuarios.Columns[1].HeaderText = "E-mail";
//gdvUsuarios.Columns[2].HeaderText = "Bloqueado";
//gdvUsuarios.Columns[3].HeaderText = "Último Login";
//gdvUsuarios.Columns[4].HeaderText = "Administrador";
Setting the values changing the caption of the DataTable doesn't work, and after the DataBind, the Columns.Count property for the DataGridView return zero columns! After executing the code, everything appears normally at my asp page, but the captions are wrong.
I have tabs in a page. Each tab has a background image of fixed length. So when the text for the tab is bigger("arrangement help"), it displays "arrangement" in one line and "help" underneath. My goal is to display arrangement and help in one line. Tabs have to customizable.I am using css for regular tabs.
#tabs a {
float:left;
background:url("../images/selection_deselect_bg.jpg") no-repeat right top;
margin:0;
text-decoration:none;
width:105px;
text-align:center;
height:24px;
font-size:12px;
color:#00779c;
font-weight:bold;
text-decoration:none;
}.
In the aspx page, tabs are defined like this
<div id="tabs">
<ul>
<span id="Tab1" runat="server">
<li id="li1"><a <%=strpage1anchor%> <%=page1display%>><span style="text">
<asp:Literal ID="litPage1" runat="server"></asp:Literal></span></a></li>
</span>
I have an bigger image and i am able to get the size of the text in tab. But how to use bigger image for the tab? How to use change background on runtime.
Tried this:
Code:
Protected Sub gvCriticalMaterials_RowCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvCriticalMaterials.RowCreated
If e.Row.RowType = DataControlRowType.DataRow Then
If Trim(e.Row.Cells(7).Text) <> "" And Trim(e.Row.Cells(10).Text) <> "" Then
If Convert.ToDateTime(e.Row.Cells(7).Text) < Convert.ToDateTime(e.Row.Cells(10).Text) Then
e.Row.Cells(7).ForeColor = Drawing.Color.Red
End If
End If
End If
End Sub
But it never shows any value for text in the cells.
First time using the ASP.NET CreateUserWizard control and we are aliasing the Username Textbox as the Email Address because the clients wants the username to be an email address. Then hiding that controls EmailAddress. This part is working fine. The problem I'm having is the error message that gets displayed on the UI says "enter a different user name." if you type in a existing email address. We need to change this to "enter a different email address". I added a event handler for the OnCreateUserError. Added the code below, and debugging the events gets hit and sets the Literal.Text of the error message to display. Still gets overwritten on a later event. Does anyone know what I'm missing to get this error message to the UI.
protected void userWizard_CreateUserError(object sender, CreateUserErrorEventArgs e)
{
// check for dupe username error
if (e.CreateUserError == MembershipCreateStatus.DuplicateUserName)
{
// If so change to dupe email error and set the literal
e.CreateUserError = MembershipCreateStatus.DuplicateEmail;
Literal errorMessage = (Literal)userWizard.WizardSteps[0].Controls[0].Controls[0].Controls[0].Controls[0].FindControl("ErrorMessage");
errorMessage.Text = "Email address already exists. enter a different email address.";
}
}
I am working in asp.net MVC & on the view has to show both json & xml content depending on some condition.
I have to change the content type of the page at runtime ie,
if the condition for json is fulfilled then set page contenttype = "text/json"
&
if the condition for xml is fulfilled then set page contenttype = "text/xml".
I have tried setting default content type on view as
<%
@
Page
Language="C#"
Inherits="System.Web.Mvc.ViewPage"
ContentType="text/json"%>
& in controller class if xml condition is fulfilled then chnage it like :
this.Response.Clear;
this.Response.ContentType = "text/xml";
BUT it didn't work for me .
I am working on an ASP.Net web application running on framework 2.0. I have values stored in users cookie. During testing when the cookie value has been changed the asp.net runtime error page gets displayed.I have custom error mode set to On but somehow this error dosent get redirected. Can anyone tell me what I need to do/set for the custom error page to get displayed in this scenario?
Runtime ErrorDescription: An application error occurred on the server. The current customerror settings for this application prevent the details of the application
error from being viewed remotely (for security reasons). It could, however,
be viewed by browsers running on the local server machine.Details: To enable the details of this specific error message to be viewableon remote machines, please create a <customErrors> tag within a "web.config"configuration file located in the root directory of the current webapplication. This <customErrors> tag should then have its "mode" attributeset to "Off".
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
[code]...
I am make website and publish it, i am used different language by Resource.resx and Resource.Ar.resx.
when publish website i see resources files convert to .dll
App_GlobalResources.dll
App_GlobalResources.compiled
AR/App_GlobalResources.resources.dll
i want to make page in administrator to can change value for any key in resources.
how i can search key by value.
then i want to put textbox to change value.
ex:
Key : MSG Value : Message.
i want to change 'Message' Value to 'welcome to visit us' throught website is running.
This property was originally set in the aspx file, however I want to change it to select programatically on page load. I set the Pager.PagedControlID property, but I receive the following error message on this line:
Pager.PageSize = Convert.ToInt32(ListLength);
Page properties cannot be set because no IPageableItemContainer has been found. The ID I am using I copied and pasted out of the inline aspx and I checked it is correct.
I have a CMS that allows an administrator to add/create pages for his website.
When a page is created a SiteMapNode is added to the web.sitemap file with the an url , title and resourceKey.
Now I wish to add a resourcekey to the appropriate web.sitemap.resx file(located in App_GlobalResources).
I have tried many different ways :
- using XMLDocument load/save => says I don't have access to write to that resource file
- ResourceReader says the source stream is not valid.
I am making a web project now. And i meet some problems working with Entity Framework. My program needs to have dynamic model. I try to explain. So i have classes and database is created from them. At the beginning of work program checks in folder Modules for assemblies and looks for classses that needs to be created as tables in database(this classes have to become a part of ef model). And i need at runtime create database.If some new classes was added so add this tables to database, but not recreate it(as it is made by default). If i delete classes the tables are not deleted.
View 2 RepliesI have a situation...i need to change requiresQuestionAndAnswer and requiresUniqueEmail values to false at runtime(for membership providers)
View 4 RepliesI'm having a problem with Microsoft Report Viewer reports in local mode...
A little background info:
I have a flat data file which I load into memory (split into fields in a dataset) and need displayed in a report. The data structure of this file is hierarchical with about 4 levels: File, Batch, Entry, and AdditionalInfo. The amount and names of the fields in the Entry records change depending on a field in their parent's Batch record (lets call this field BatchType). So while I'm reading Batches i need to look at this BatchType field to know how to read/display the child Entries.
Problem:
Since my Entry sections in my report will be different depending on the BatchType field in the Batch record, I researched a bit and found out that the only way to do this was to do subreports. I figured I'd have to have a different subreport for each Entry type. However, I've been unable to find a way to change the ReportName parameter in the subreport object during runtime. I dont even know if it's possible to change a subreport's ReportName on the fly.