I have Web Application in asp.net.
Where I am maintaining Session for every User. And every Time I got logout in Approx 2 min.
I tried to increase this time through web Config File upto 60 min but it is not working For me and I m getting same problem.
I have created A class file For maintaining session.I am Using This Code.
public static void createSession(System.Web.SessionState.HttpSessionState session)
{
Session = session;
}
This is my class file code.
And I am calling this function in login Page load like this.
BusinessClasses.SessionHandler.createSession(Page.Session);
Then After I am Checking In everyPage.
But this code is not working for me.
Please Give Suggest me correct solution for this problem.
Hi,
I am working on an app where i am having some linkbuttons in master page.
I want to display them depending upon the authorization given to them once they logs in. I have initially made all of them visible false and then i am checking the authorisation in the aspx.cs class of master page. I make the link button visible depending upon the right granted to the user. But it is making all the link buttons visible. Instead it should only make two of them visible and rest should be hidden. Following is my code from MasterPage.aspx.cs:
ArrayList arrlstUserRoles = new ArrayList();
arrlstUserRoles = (ArrayList)Session["Roles"];
for (int j = 0; j < arrlstUserRoles.Count; j++)
{
if (int.Parse(arrlstUserRoles[j].ToString()) == 1)
{
lbtnRetailer.Visible = true;
}
else if (int.Parse(arrlstUserRoles[j].ToString()) == 2)
{
lbtnCategory.Visible = true;
}
else if (int.Parse(arrlstUserRoles[j].ToString()) == 3)
{
lbtnCouponTemplate.Visible = true;
}
else if (int.Parse(arrlstUserRoles[j].ToString()) == 4)
{
//lbtnStoreManagement.Visible = true;
}
else if (int.Parse(arrlstUserRoles[j].ToString()) == 5)
{
lbtnStoreManagement.Visible = true;
}
else if (int.Parse(arrlstUserRoles[j].ToString()) == 6)
{
lbtnContentManagement.Visible = true;
}
else if (int.Parse(arrlstUserRoles[j].ToString()) == 7)
{
//lbtnStoreManagement.Visible = true;
}
}
Hello All
i have a US states list
List<string> state // contain all 51 US states
Now i have a string which contain some text like okl (it means Oklahoma for me). what i want i want 'like' query in List state and get Oklahoma state.
I need to import a text file into a temporary table and from that select portions of it to insert in different tables. I wanted to use 'LOAD DATA INFILE'.
Is there any way, i can use 'Load data infile' in a stored procedure.
I am using mysql.
LOAD DATA LOCAL INFILE 'C:\\MyData.txt' INTO TABLE
tempprod fields terminated by ',' lines terminated by '\r\n';
SELECT * FROM product p;
Hello All
I have 2 tables Project and ProjectList like this
Project
ProjectID
Name
ProjectListID - allow null
In ProjectList
ProjectListID
ProjName
Now what i need here, i want only those recoed from ProjectList table which ProjectListID not in Project table.
I made a query but it is taking lot of time to execute.
select * FROM projectslist pl where pl.ProjectsListID not in (SELECT p.ProjectsListID FROM project p where (p.ProjectsListID is not null and p.ProjectsListID <>0))
Please help me to create optimize query. I am using My SQL.
I am trying UpdatePanel & AsyncPostBackTrigger on master pages through find control method but problem is when I click on button (UpdateButton) It just flash/flick (No Postback) the UpdatePanle but still it don't update or refresh the gridview (images) inside the updatePanel.
I have placed script Manger on the master page & an AJAX Update panel in a ContentPlaceHolder in the child page. Also, in another ContentPlaceholder there is an asp button (outside of the UpdatePanel).
I want to refresh/reload the AJAX UpdatePanel with this asp button.
Thanks for suggestions.
Child Page Code :-
protected void Page_Load(object sender, EventArgs e)
{
ScriptManager ScriptManager1 = (ScriptManager)Master.FindControl("ScriptManager1");
ContentPlaceHolder cph = (ContentPlaceHolder)Master.FindControl("cp_Button");
Button btnRefresh = (Button)cph.FindControl("btnRefresh");
ScriptManager1.RegisterAsyncPostBackControl(btnRefresh);
}
protected void btnRefresh_Click(object sender, EventArgs e)
{
UpdatePanel1.Update();
}
<%@ Page Title="" Language="C#" MasterPageFile="~/InnerMaster.master" AutoEventWireup="true" CodeFile="A.aspx.cs" Inherits="A" Async="true" %>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" Runat="Server">
<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="id" DataSourceID="SqlDataSource1">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Image ID="img12" runat="server" Width="650px" Height="600" ToolTip="A" ImageUrl='<%# Page.ResolveUrl(string.Format("~/Cli/{0}", Eval("image"))) %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="cp_Button" Runat="Server">
<asp:Button ID ="btnRefresh" runat="server" onclick="btnRefresh_Click" Height="34" Width="110" Text="More Images" />
</asp:Content>
Hi updated code :- Now on click event whole pages is refreshed.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
namespace EProxy
{
public class EventProxy : Control, IPostBackEventHandler
{
public EventProxy()
{ }
public void RaisePostBackEvent(string eventArgument)
{ }
public event EventHandler<EventArgs> EventProxied;
protected virtual void OnEventProxy(EventArgs e)
{
if (this.EventProxied != null)
{
this.EventProxied(this, e);
}
}
public void ProxyEvent(EventArgs e)
{
OnEventProxy(e);
}
}
}
On Master Page Code (btn click):-
protected void btnRefresh_Click(object sender, EventArgs e)
{
ContentPlaceHolder cph = (ContentPlaceHolder)this.FindControl("MainContent");
EventProxy eventProxy = (EventProxy)cph.FindControl("ProxyControl") as EventProxy;
eventProxy.ProxyEvent(e);
}
Web Config :-
<pages maintainScrollPositionOnPostBack="true" enableViewStateMac="true">
<controls>
<add tagPrefix="it" namespace="EProxy" assembly="App_Code"/>
</controls>
</pages>
I have a javascript function for checking errors which i am callin on OnClicentClick event of a button. Once it catch a error i want to stop execution of click event . But in my case it always it always executes the onclick event. Following is my function:
function DisplayError() {
if (document.getElementById('<%=txtPassword.ClientID %>').value.length < 6 || document.getElementById('<%=txtPassword.ClientID %>').value.length > 12) {
document.getElementById('<%=lblError.ClientID %>').innerText = "Password length must be between 6 to 12 characters";
return false;
}
var str = <%=PhoneNumber()%>;
if(str.length <10)
{
alert('<%=phoneNum%>'.length);
document.getElementById('<%=lblError.ClientID %>').innerText = "Phone Number not in correct format";
return false;
}
}
button html code:
<asp:Button runat="server" Text="Submit" ID="btnSubmit" ValidationGroup="submit" onclick="btnSubmit_Click" OnClientClick="DisplayError()"/>
It should not execute the button click event once it satisfies any of the IF condition in javascript function.
I am searching a batter solution for creating xml through xml serialization. What i need, i have a given format like this
<product Id="1">
<name>2 1/2 X 6 PVC NIPPLE TOE SCH 80</name>
<notes>
<note>!--note 1---</note>
<note>!--note 2--</note>
......
</notes>
</product>
what i am doing here, i created a 2 classes like this
public class product
{
[XmlElement("name")]
public string Name { get; set; }
[XmlArray("notes")]
public List<notes> ListNotes { get; set; }
}
public class notes
{
[XmlIgnore]
public string Note { get; set; }
}
when i am serializing this then i am getting xml in this formate
<product Id="1">
<name>2 1/2 X 6 PVC NIPPLE TOE SCH 80</name>
<notes>
<notes>
<note>!--note 1---</note>
<note>!--note 2--</note>
</notes>
</notes>
</product>
i don't want extra <notes>. Any batter solution to solve this problem?
Thanks
Hello Everyone
I want to check render time of each page in asp.net mvc application.
i am using asp.net tracing. i have override the OnActionExecuting and OnActionExecuted methods on the BaseController class.
protected override void OnActionExecuting(ActionExecutingContext filterContext)
{
string controler = filterContext.RouteData.Values["controller"].ToString();
string action = filterContext.RouteData.Values["action"].ToString();
StartTime =System.DateTime.Now;
System.Diagnostics.Trace.Write(string.Format("Start '{0}/{1}' on: {2}", controler, action, System.DateTime.Now.UtilToISOFormat()));
}
protected override void OnActionExecuted(ActionExecutedContext filterContext)
{
string controler = filterContext.RouteData.Values["controller"].ToString();
string action = filterContext.RouteData.Values["action"].ToString();
var totalTime = System.DateTime.Now - this.StartTime;
System.Diagnostics.Trace.Write(totalTime.ToString());
System.Diagnostics.Trace.Write(string.Format("End '{0}/{1}' on: {2}", controler, action, System.DateTime.Now.UtilToISOFormat()));
}
in OnActionExecuted method i get total time. how can i show this time in my http://localhost:51335/Trace.axd report?
I am feeling problem when generating .pdf file from excel2007(.xlsx) file using code like excelWorkBook.ExportAsFixedFormat(paramExportFormat,
paramExportFilePath, paramExportQuality,
true, false, paramMissing, paramMissing, paramOpenAfterPublish,paramMissing);
THe generated pdf having chart image show with border on XP 2003 server
so it cut some other part. Which not come if generated locally on xp system.
I have a table with 50 rows. I want to select particular rows with checkmark accessory but when i select some rows and scroll down the table then i see pre checked rows. I know that table cell are reused but i want to emit this problem what can i do about this?
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
// return [array count];
return 50;
}
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
TableViewCell *cell = (TableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[TableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
cell.textLabel.text=[NSString stringWithFormat:@"%i",[indexPath row]];
return cell;
}
// Override to support row selection in the table view.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
if (cell.accessoryType == UITableViewCellAccessoryNone) {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
} else {
cell.accessoryType = UITableViewCellAccessoryNone;
}
Hello,
I have program where i want to scrap some Useful study material for me.
This site site maintaining session key and some other key also.
If I trying to go nested page then it will throw me out and showing session out message.
I unable to maintaining session key in web request class.
so please give me some idea that how can i maintain session in web request class.
This code is not working on IE8
window.open(url, "find_users",
"resizable=yes,scrollbars=yes,menubar=no,toolbar=no,location=no,status=yes,height=300,width=500");
I am getting Object Expected error in only IE8, its working fine in all other brouser.
string a="I am comparing 2 string";
string b="I am comparing 2 string";
if(a==b)
return true;
else
return false;
How does a .NET compiler compare two strings? Is string work like a struct or like an int?
I have two image views, one on top of the another, with two different images. As the user touches the image and moves his/her finger, the top image should become transparent along the touch points with a fixed radius. (Like the PhotoChop app).
Currently I am doing it this way...
For each touch.
Get a copy of the image buffer from CGImage of the top image.
Edit the alpha channel of the buffer to create a transparent circle centered at the touch point.
Create new CGImage from the buffer.
Create UIImage from the CGImage and use the new UIImage as the top image view's image.
This works but as you can see too many copy, creates are involved and it is slow.
Can somebody please suggest me a faster way of doing the same thing?
Hello All
I have a class ClientState
Class ClientState
{
Public int ID{get;set;}
public string State{get;set;}
}
List<ClientState> listClientState which contain all states of USA, Now may problem is listClientState contain some objects which have duplicates states.
How can i filter listClientState to remove duplicate record
Hi,
Actually make application on Google android g1 but normal screen size But I Want To increase
my screen size up to 1024x600 then how I can increase please help.........?
Hi guys i am using android ndk and for that i am trying to create a c header file using javah tool how to use and where to use this tool i am unable to understand so please any one can
tell me the procedure how to do that i am waiting for the reply please.........
Hi,
I am working on a application where i am using rowupdating event of the gridview. I am using templatefield in my columns so i am not able to get the new values from the textboxws that i am having in the gridview. How can i get the new values from the textboxes. Following is my code in rowupdating:
protected void gviewTemplate_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
gviewTemplate.EditIndex = -1;
string rowNum = ViewState["ID"].ToString();
Label lbl2 = (Label)gviewTemplate.Rows[e.RowIndex].FindControl("lblTemplateName");
Label lbl1 = (Label)gviewTemplate.Rows[e.RowIndex].FindControl("lblUploaded");
TextBox txtTempName = (TextBox)gviewTemplate.Rows[e.RowIndex].FindControl("txtTemplateName");
TextBox txtHeading = (TextBox)gviewTemplate.Rows[e.RowIndex].FindControl("txtHeading");
TextBox txtCoupon = (TextBox)gviewTemplate.Rows[e.RowIndex].FindControl("txtCouponText");
TextBox txtBrand = (TextBox)gviewTemplate.Rows[e.RowIndex].FindControl("txtBrandName");
TextBox txtSearchText = (TextBox)gviewTemplate.Rows[e.RowIndex].FindControl("txtSearch");
TextBox txtDiscount = (TextBox)gviewTemplate.Rows[e.RowIndex].FindControl("txtDiscount");
TextBox txtStartDt = (TextBox)gviewTemplate.Rows[e.RowIndex].FindControl("txtStartDt");
}
i want to get the new values form these textboxes but it is always giving me old values. and yes, e.Newvalues is not giving me anything. It is always empty. This is small extract from my gridview design:
<asp:GridView runat="server" AutoGenerateColumns="False"
ID="gviewTemplate" onrowdatabound="gviewTemplate_RowDataBound" DataKeyNames="F1"
onrowcommand="gviewTemplate_RowCommand"
onrowediting="gviewTemplate_RowEditing"
onrowcancelingedit="gviewTemplate_RowCancelingEdit"
onrowupdating="gviewTemplate_RowUpdating"
onrowdeleting="gviewTemplate_RowDeleting"
onrowupdated="gviewTemplate_RowUpdated">
<Columns>
<asp:TemplateField HeaderText="Uploaded Image">
<EditItemTemplate>
<asp:LinkButton Text="Reload" runat="server" OnClick="lbtnReloadImage_Click" CommandName="reload" ID="lbtnReloadImage"></asp:LinkButton>
</EditItemTemplate>
<ItemTemplate>
<table id="Table2" runat="server" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<asp:Label Runat="server" Text='<%# Eval("Uploaded") %>' ID="lblUploaded"></asp:Label>
</td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Template Name">
<ItemStyle VerticalAlign="Top" HorizontalAlign="Center" />
<EditItemTemplate>
<asp:TextBox ID="txtTemplateName" Width="60" Runat="server" Text='<%# Eval("F1") %>'></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" Runat="server"
ErrorMessage="You must provide a Product Name." ControlToValidate="txtTemplateName">*</asp:RequiredFieldValidator>
</EditItemTemplate>
<ItemTemplate>
<table id="Table3" runat="server" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<asp:Label ID="lblTemplateName" runat="server" Text='<%# Eval("F1") %>'></asp:Label>
</td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Heading">
<ItemStyle VerticalAlign="Top" HorizontalAlign="Center" />
<EditItemTemplate>
<asp:TextBox ID="txtHeading" Runat="server" Width="60" Text='<%# Eval("F2") %>'></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" Runat="server"
ErrorMessage="You must provide a Product Name." ControlToValidate="txtHeading">*</asp:RequiredFieldValidator>
</EditItemTemplate>
<ItemTemplate>
<table id="Table4" runat="server" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<asp:Label ID="lblHeading" runat="server" Text='<%# Eval("F2") %>'></asp:Label>
</td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Coupon Text">
<ItemStyle VerticalAlign="Top" HorizontalAlign="Center" />
<EditItemTemplate>
<asp:TextBox ID="txtCouponText" Runat="server" Width="80" Text='<%# Bind("F3") %>'></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" Runat="server"
ErrorMessage="You must provide a Product Name." ControlToValidate="txtCouponText">*</asp:RequiredFieldValidator>
</EditItemTemplate>
<ItemTemplate>
<table id="Table5" runat="server" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<asp:Label Runat="server" Text='<%# Bind("F3") %>' ID="lblCouponText"></asp:Label>
</td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateField>
Can anyone please tell me how to get the new values from these textboxes?
Hello All
I am using this toolkit to write Excel.Every thing is fine with this, but i am not getting how can i inset image and also put style on some rows on my excel
http://excelpackage.codeplex.com/wikipage?title=Creating%20an%20Excel%20spreadsheet%20from%20scratch&referringTitle=Home
i am using c#
I have created an windows service. I want to open some windows based application from this service.
But my windows service is unable to start desktop applications. To enable the access I had to do the following steps:
Opened the administrative tool "Services"
Right clicked on my service and had to select "properties"
Then in the "Log On" tab, selected "Allow service to interact with desktop".
After that my service can open desired windows based processes.
Can I configure my windows service in the code (C#) to access the desktop so that I won't have to change the access permission manually after installation?