|
Hi
To me it seems "readerdate" is data reader object. if so ,Convert.ToDatetime does not take a reader obejct as input. Select a pecific column of the reader object what I mean is something like this,
<br />
int i=0;<br />
DateTime dtlogtime = Convert.ToDateTime(readerdate[i]);<br />
if (dttimenow.AddMinutes(1) > dtlogtime)<br />
{<br />
}<br />
<br />
Thanks,
Arindam D Tewary
|
|
|
|
|
hi
readerdate being the string value from the database
sorted it
DateTime dtlogtime = Convert.ToDateTime(readerdate);
if (dtlogtime.AddMinutes(1) < dttimenow)
cheers
|
|
|
|
|
Try DateTime.Parse
only two letters away from being an asset
|
|
|
|
|
Hello friends
my question is
How to add a checkbox conrol to datalist or datagrid in single cell(2,2)
thanking you
sam
Final year student of MCA
|
|
|
|
|
U can add that on ItemDataBound Event of DataGrid....
|
|
|
|
|
I am creating application using asp.net and c# and Oracle 10G as database. I am using Nhibernate
When I execeute from query from my page query first time it works fine and also do its job but in the same session if i try to run the same query it is giving me an exception which is
“From Keyword exception”.
The query is written on Command button using a Command button.
I have debugged the code and from the command object I pick up the query and run into SQL developer its running fine.
I also assure as Nhibernate session is also closed.
I also try Global.asax to close the Nhibernate Session.
To start with it looks like session problem which i tried to knock out by closing session, reader, object and also disposing command object.
Any suggestion to resolve this .
Thanks
Waqas
|
|
|
|
|
Dear Friends,
i have created one grid with servral controls on it now i am accessing the data of that control using GridView.FindControl("ControlName") method which is return me the control to access the data but each time i have to follow the process of providing ("ControlName") of that control. Instead of that i want to create an class which can take the gridview as input and provide me the output as "ControlName = ControlValue" as an collection which can be easy to integrate with my Database class can anyone guide me how can i access the control at run time and store the value in my collection
or is there another simple way if any please provide me.
thanks in advance.
Sasmi
|
|
|
|
|
Hello all,
I've been tinkering with a small Content Management System called ScrewTurnVisualizer that I've found on http://blog.lavablast.com/post/2008/01/Dirt-Simple-ASPNET-CMS-using-the-ScrewTurn-Wiki.aspx
I have converted the code for this short program, which was written in C# to VB with a converter I've found online. When I tried to build and run this program in VS2003, I've got more than 3 dozen error messages. I'm wondering if this CMS is written using dotnet 2.0 and if that is why I've been getting so many error messages. If it was indeed written using dotnet 2.0 could you please show me how to convert it so that it is compatible with VS2003? Below is the code that I've got after the C# conversion to VB. Any help will be greatly appreciated and thank you in advance for your time.
<br />
<br />
<br />
<br />
Imports System<br />
Imports System.Collections.Generic<br />
Imports System.ComponentModel<br />
Imports System.Text<br />
Imports System.Web<br />
Imports System.Web.UI<br />
Imports System.Web.UI.WebControls<br />
Imports System.Net<br />
Imports System.IO<br />
Imports System.Text.RegularExpressions<br />
Imports System.Web.Caching<br />
<br />
<br />
Namespace LavaBlast.CustomControls<br />
<defaultproperty("text")> _<br />
<toolboxdata("><{0}:screwturnvisualizer runat="server"></{0}:screwturnvisualizer>")> _<br />
Public Class ScrewturnVisualizer<br />
Inherits WebControl<br />
<bindable(true)> _<br />
<category("data")> _<br />
<defaultvalue("")> _<br />
<localizable(true)> _<br />
Public Property PageName() As String<br />
Get<br />
Dim s As String = DirectCast(ViewState("PageName"), String)<br />
Return (IIf((s Is Nothing),[String].Empty,s))<br />
End Get<br />
<br />
Set<br />
ViewState("PageName") = value<br />
End Set<br />
End Property<br />
<br />
<bindable(true)> _<br />
<category("data")> _<br />
<defaultvalue("")> _<br />
<localizable(true)> _<br />
Public Property BaseURL() As String<br />
Get<br />
Dim s As String = DirectCast(ViewState("BaseURL"), String)<br />
If s IsNot Nothing AndAlso Not s.EndsWith("/") Then<br />
s += "/"<br />
End If<br />
Return (IIf((s Is Nothing),[String].Empty,s))<br />
End Get<br />
<br />
Set<br />
ViewState("BaseURL") = value<br />
End Set<br />
End Property<br />
Public ReadOnly Property FullURL() As String<br />
Get<br />
Return GetFullPath(BaseURL, PageName)<br />
End Get<br />
End Property<br />
<br />
<bindable(true)> _<br />
<category("data")> _<br />
<defaultvalue("")> _<br />
<localizable(true)> _<br />
Public Property CacheText() As Boolean<br />
Get<br />
Return CBool((IIf(ViewState("CacheText") Is Nothing, (ViewState("CacheText") = True), ViewState("CacheText"))))<br />
End Get<br />
Set<br />
ViewState("CacheText") = value<br />
If Not value Then<br />
If Page IsNot Nothing Then<br />
Page.Cache.Remove("ScrewturnVisualizer_" + FullURL)<br />
End If<br />
End If<br />
End Set<br />
End Property<br />
<br />
Public Function GetPageContents() As String<br />
If CacheText AndAlso Me.Page.Cache("ScrewturnVisualizer_" + FullURL) IsNot Nothing Then<br />
Return Me.Page.Cache("ScrewturnVisualizer_" + FullURL).ToString()<br />
End If<br />
<br />
Dim s As String = GetScrewturnPageContent(BaseURL, PageName)<br />
<br />
If CacheText Then<br />
Me.Page.Cache.Add("ScrewturnVisualizer_" + FullURL, s, Nothing, Cache.NoAbsoluteExpiration, New TimeSpan(1, 0, 0), CacheItemPriority.[Default], _<br />
Nothing)<br />
End If<br />
<br />
Return s<br />
End Function<br />
<br />
Public Shared Function GetFullPath(ByVal baseUrl As String, ByVal pageName As String) As String<br />
Return baseUrl + "Print.aspx?Page=" + pageName<br />
End Function<br />
<br />
Public Shared Function GetScrewturnPageContent(ByVal baseUrl As String, ByVal pageName As String) As String<br />
Dim s As String = ""<br />
Try<br />
Dim req As HttpWebRequest = DirectCast(HttpWebRequest.Create(GetFullPath(baseUrl, pageName)), HttpWebRequest)<br />
req.UserAgent = "LavaBlast"<br />
req.CookieContainer = New CookieContainer()<br />
Dim response As HttpWebResponse = DirectCast(req.GetResponse(), HttpWebResponse)<br />
response.Cookies = req.CookieContainer.GetCookies(req.RequestUri)<br />
<br />
Dim reader As New StreamReader(response.GetResponseStream())<br />
s = reader.ReadToEnd()<br />
reader.Close()<br />
<br />
s = Regex.Replace(s, "<a[^>]*>Edit", "", RegexOptions.Compiled)<br />
s = Regex.Replace(s, "^.*<input.*id value=".[^""]*""" />", "", RegexOptions.Compiled Or RegexOptions.Singleline)<br />
s = Regex.Replace(s, ".*$", "", RegexOptions.Compiled Or RegexOptions.Singleline)<br />
s = Regex.Replace(s, "<h1 class=".pagetitle.">[^<]*</h1>", "", RegexOptions.Compiled)<br />
s = Regex.Replace(s, "<h2 class=".seperator.">(?<title>[^<]*)</title></h2>", "<h2>${title}</h2>", RegexOptions.Compiled)<br />
<br />
s = Regex.Replace(s, "GetFile.aspx.File=", "images/", RegexOptions.Compiled)<br />
Catch ex As Exception<br />
System.Diagnostics.Debug.WriteLine([String].Format("An error has occurred accessing {0}.<br />{1}", baseUrl + "Print.aspx?Page=" + pageName, ex.ToString()))<br />
s = "An error has occurred."<br />
End Try<br />
Return s<br />
End Function<br />
<br />
Protected Overloads Overrides Sub RenderContents(ByVal output As HtmlTextWriter)<br />
output.Write(GetPageContents())<br />
End Sub<br />
End Class<br />
End Namespace<br />
<br />
</a[^></localizable(true)></defaultvalue("")></category("data")></bindable(true)></localizable(true)></defaultvalue("")></category("data")></bindable(true)></localizable(true)></defaultvalue("")></category("data")></bindable(true)></toolboxdata("></defaultproperty("text")>
modified on Tuesday, February 26, 2008 7:12 AM
|
|
|
|
|
I am using a Radio button List in my application. The first button is checked by default.
When i enter a search text in a textbox and click the second button if it is null or invalid text it throws an error message....
and the second button is checked ......
I want the first button to be checked if invalid text enters and error message is shown...
the code is attached....
<asp:radiobuttonlist id="rbperspect" runat="server" autopostback="True" font-bold="True"><br />
RepeatDirection="Horizontal" Width="202px" Height="18px" OnSelectedIndexChanged="rbperspect_SelectedIndexChanged"><br />
<br />
<br />
<br />
</asp:radiobuttonlist>
SAJAN A PILLAI
C#.NET Programmer
TELESOFT INDIA PVT LTD...
BANGALORE
"Winners don't do different things. They do things differently. ...
|
|
|
|
|
i have a link button control in the gridview. i have done data binding in this contol
i have an event , row command of the gridview,now the problem is when i click the linkbutton , and if i have stated the postback url property then it is not comming in the row command event.
if i don't use the post back url event , then it is comming in the event.
Y it is happening.
it there any contol that can be used to send in the row command event along with the post back url property
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
HTML SIDE
------------------
<asp:templatefield headertext="Action">
<itemtemplate>
<asp:linkbutton id="LnkDetails" runat="server" text="Details" postbackurl="">
CODEBEHIND SIDE
-------------------
protected void Gridjango_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
GridViewRow Row = e.Row;
int JobID = Convert.ToInt32(Row.Cells[0].Text);
LinkButton LnkDetails = (LinkButton)Row.FindControl("LnkDetails");
string url = "Test.aspx?JobID=" + JobID;
LnkDetails.OnClientClick = "window.open('" + url + "','popup','toolbar=no,location=no,direction=no,status=no,menubar=no,scrolling=yes,resizable=no,width=400,height=450,left=200,top=50'); return false;";
}
}
|
|
|
|
|
Can anyone know how to invoke/open Yahoo messenger in client machine from Classic ASP.
Subash
|
|
|
|
|
You really can't, because the web browser cannot open other apps.
This is the ASP.NET forum, not ASP.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I am trying to delete a directory using object of Directoryinfo but it leaves an inaccessible directory on disk. This folder becomes Read only.How can I delete directory permanently.
|
|
|
|
|
In ASP.NET, you can only manipulate folders within your server root directory
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
How can I set resolution of uploaded image and convert it into byte array so that I can store it in database
|
|
|
|
|
The bitmap class's save method has an over load that takes a stream, you can use a buffered stream to end up writing to a byte array.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi
Thanks for your response. In the following code I get error
System.Runtime.InteropServices.ExternalException: A
generic error occurred in GDI+.. Please help me.
string NewFile = System.IO.Path.GetFileName(userPostedFile.FileName);
string imagepath = filepath + System.IO.Path.GetFileName(userPostedFile.FileName);
System.Drawing.Image imgSource = System.Drawing.Image.FromFile(imagepath , true);
Bitmap bmp = new Bitmap(imgSource);
bmp.SetResolution(72, 72);
bmp.Save(NewFile);
FileStream fs = File.Open(NewFile, FileMode.Open);
System.Drawing.Bitmap newimg = new System.Drawing.Bitmap(fs);
MemoryStream ms = new MemoryStream();
newimg.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
newimg.Dispose();
byte[] imgdata = new byte[ms.Length];
ms.Read(imgdata, 0, NewFile.Length);
imgdata= ms.ToArray();
Thanks
|
|
|
|
|
Which line gives the error ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi
I have a web-page which displays details from a database to a user which can be updated.
How can i lock the page to a specific user so that if a different user logs on and tried to access it they can only see a read only version.
any articles or ideas would be great
thanks!!!
|
|
|
|
|
You would do this in the DB, you'd store a value to say which user had the lock, and the date/time of the lock, so it can be expired after an appropriate time
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi
thanks for the reply.
I have now set up a table which stored a session value for the user's login
My next question is, is it possible to delete the person's entry into the table after say half hour?
any help would be great
thanks
|
|
|
|
|
When you try to access the record, you check if it's locked, AND you check the time it was locked. If the lock has timed out, you ignore/overwrite it.
It doesn't matter if it timed out after 30 minutes, only that it was recognised as having timed out at whatever point after 30 min, someone else tried to access it.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
yeh but thats the bit i'm stuck on
How would i check that its been more then 30 minutes?
i.e. do i have an IF statement in the c# code saying something like
if datetimefield > 30???....
This is a new area to me
I undertsand the logic just don't know the syntax to check for more than 30 mins
thanks for the help so far!
|
|
|
|
|
hi,
-> how to store session id in URL ?
Dude...
modified on Tuesday, February 26, 2008 4:57 AM
|
|
|
|