Try it using RegisterStartupScript(Type, string, string), it will work as per ur expectation. :)
Confidence comes not from always being right, but from not fearing to be wrong. Mihir..
Try it using RegisterStartupScript(Type, string, string), it will work as per ur expectation. :)
Confidence comes not from always being right, but from not fearing to be wrong. Mihir..
Hi there, Write the following header settings in Page Load event, Page will always rendered from the server rather than from cache... and displays a message stating that page is expired.
Response.AddHeader ("Pragma", "no-cache");
Response.Cache.SetCacheability (HttpCacheability.NoCache);
Response.Cache.SetExpires (DateTime.Now.AddHours (-1));
Confidence comes not from always being right, but from not fearing to be wrong. Mihir..
hi there, more appropriate solution is as follows
Private Sub IncrementObject(INumber incrementor)
incrementor.Increment()
End Sub
Public Shared Sub Main()
Dim s As New Sequential()
Dim n As New Numeric()
''
'' This will execute Increment logic of Sequential Class
IncrementObject(s);
''
'' This will execute Increment logic of Numeric Class
IncrementObject(n);
End Sub
Above method accepts object of type INumber, so any number of classes in which you implement INumber interface can be passed as argument in this method and this method will execute appropriate logic of increment, Instance of Sequential Type will execute its own increment method.
Confidence comes not from always being right, but from not fearing to be wrong. Mihir..
hi there, Review the following code i hope this will help you.
Private Sub IncrementObject(Object obj)
Dim incrementor As MyInterface
incrementor = CType(obj, MyInterface)
incrementor.increment()
End Sub
Private Sub Main()
Dim class1 As New MyClass1
Dim class2 As New MyClass2
Dim class3 As New MyClass3
IncrementObject(class1)
IncrementObject(class2)
IncrementObject(class3)
End Sub
:)
Confidence comes not from always being right, but from not fearing to be wrong. Mihir..
Hi all, I have developed a custom pager control, which has been inherited from WebControl, IPostBackDataHandler. Function of the control is to render a pager layout ( page numbers, next, prev, buttons ) and raise an event on the server when page change in UI. Problem is what when i place any validator control which are validate on server only are raising validation on custom pager control's post back. code preview
PreRender(){
// Registering client script block that set page index in hidden
// and submit the form
}
Render(){
// Rendering set of links ( ) that will call my javascript function
// to set page index in hidden and post back the page
}
LoadPostData(){
// Check hidden variable and return true to raise event
}
RaisePostDataChangedEvent(){
// Raising PageIndexChanged event
}
if anybody has resolution of this problem, please guide me, i will be very thankful to all of you.
Confidence comes not from always being right, but from not fearing to be wrong. Mihir..
Hi all, I have developed a custom pager control, which has been inherited from WebControl, IPostBackDataHandler. Function of the control is to render a pager layout ( page numbers, next, prev, buttons ) and raise an event on the server when page change in UI. Problem is what when i place any validator control which are validate on server only are raising validation on custom pager control's post back. :confused: code preview
PreRender(){
// Registering client script block that set page index in hidden
// and submit the form
}
Render(){
// Rendering set of links ( ) that will call my javascript function
// to set page index in hidden and post back the page
}
LoadPostData(){
// Check hidden variable and return true to raise event
}
RaisePostDataChangedEvent(){
// Raising PageIndexChanged event
}
if anybody has resolution of this problem, please guide me, i will be very thankful to all of you.
Confidence comes not from always being right, but from not fearing to be wrong. Mihir..
hi there you should bind DropDown control like this...
meetingDateDdl.DataSource = room.Meetings;
meetingDateDdl.DataTextField = "MeetingID";
meetingDateDdl.DataValueField = "Description";
meetingDateDdl.DataBind();
//the following line gives u the exact selected MeetingID
string selectedMeetingID = meetingDateDdl.SelectedValue;
:)
Confidence comes not from always being right, but from not fearing to be wrong. Mihir..
hi there, you can convert the database DateTime type to string in your front-end code like follows string sDate = dbDate.ToString( "dd/MM/yyyy HH:mm" ); will returns time in 24 hours format :) Confidence comes not from always being right, but from not fearing to be wrong..... Mihir..
hi samy, you can replace the file path with yours but make sure that your folder must have rights(atleast Read) to the ASPNET machine user.
string sFilePath = "c:\\inetpub\\wwwroot\\files\\file1.ext";
it will work fine...:) Confidence comes not from always being right, but from not fearing to be wrong..... Mihir..
hi, like this,
int count = 0;
HtmlForm form = (HtmlForm)this.FindControl( "Form1" );
if( form != null )
foreach ( Control control in form.Controls )
if ( control is TextBox )
count++;
Response.Write( count.ToString() );
:) Confidence comes not from always being right, but from not fearing to be wrong..... Mihir.. -- modified at 0:52 Tuesday 17th January, 2006
hi, *ASPNET machine user must have access rights to this file.
string sFilePath = Server.MapPath( [your file name] );
if ( File.Exists( sFilePath ) )
{
Response.Clear();
Response.ContentType = "application/" + Path.GetExtension( sFilePath );
Response.AddHeader( "Content-Disposition", "attachment; filename=\"" + Path.GetFileName( sFilePath ) + "\"" );
Response.Flush();
Response.WriteFile( sFilePath );
Response.End();
}
:) Confidence comes not from always being right, but from not fearing to be wrong..... Mihir..
hi there try this
<asp:HyperLinkColumn DataNavigateUrlField="prod_num" DataNavigateUrlFormatString="cardinfo.php?prodnum={0}"
DataTextField="sku" HeaderText="SKU"></asp:HyperLinkColumn>
thanks to both.. i have solved the problem.. problem was with SmartNavigation property of the page, i dont know why it is happening. i had set this property to True. By restoring the default value problem has solved. Confidence comes not from always being right, but from not fearing to be wrong..... Mihir..
hi all i have problem in file IO, if one of you can solve the problem i will very thank full to him/her... Description: i hv one page that enables the user to upload file, for that i use HttpInputFile control to receive posted file by user. i can save posted file but i can not delete that posted file, it is throwing an Exception "System.IO.IOException: The process cannot access the file ". another process 'aspnet_wp.exe' is accessing the same file. Code:
void SaveFile()
{
filInput.PostedFile.SaveAs(filename);
//Validation code to check the file whether it is valid or not
//if invliad delete the file and show message
File.Delete(filename); // Error line
}
Confidence comes not from always being right, but from not fearing to be wrong..... Mihir..
hi all, i have a page that enables site user to download report files from the server. report file types are .pdf, .doc, .ppt and .xls for that what i am doing is creating a Stream from file and convert it into the byte and binary write the output... so it is working fine in IE but while using netscape, the download dialog concat the file name with .aspx ( fileName.pdf.aspx ), so netscape can not open the file with proper application.. any solution please help me, thanks in advance here i m giving my code for depth review the problem
if ( File.Exists( sPathName ) )
{
using( FileStream oFStream = new FileStream( sPathName, FileMode.Open ) )
{
iFileLength = (int)oFStream.Length;
buffer = new byte[iFileLength];
oFStream.Read( buffer, 0, iFileLength );
oFStream.Close();
}
Response.Buffer = true;
Response.Clear();
Response.ContentType = "application/" + Path.GetExtension( sPathName ).Remove(0, 1);
Response.AddHeader( "Content-Type", "application/octet-stream" );
Response.AddHeader( "Content-Length", iFileLength.ToString() );
Response.AddHeader( "Content-Disposition", "attachment; filename=\"" + Path.GetFileName( sPathName ) + "\"; Size=" + iFileLength.ToString());
Response.BinaryWrite( buffer );
Response.Flush();
}
Confidence comes not from always being right, but from not fearing to be wrong..... Mihir..
hi all, i have a page that enables site user to download report files from the server. report file types are .pdf, .doc, .ppt and .xls for that what i am doing is creating a Stream from file and convert it into the byte and binary write the output... so it is working fine in IE but while using netscape, the download dialog concat the file name with .aspx ( fileName.pdf.aspx ), so netscape can not open the file with proper application.. any solution please help me, thanks in advance here i m giving my code for depth review the problem
if ( File.Exists( sPathName ) )
{
using( FileStream oFStream = new FileStream( sPathName, FileMode.Open ) )
{
iFileLength = (int)oFStream.Length;
buffer = new byte[iFileLength];
oFStream.Read( buffer, 0, iFileLength );
oFStream.Close();
}
Response.Buffer = true;
Response.Clear();
Response.ContentType = "application/" + Path.GetExtension( sPathName ).Remove(0, 1);
Response.AddHeader( "Content-Type", "application/octet-stream" );
Response.AddHeader( "Content-Length", iFileLength.ToString() );
Response.AddHeader( "Content-Disposition", "attachment; filename=\"" + Path.GetFileName( sPathName ) + "\"; Size=" + iFileLength.ToString());
Response.BinaryWrite( buffer );
Response.Flush();
}
Confidence comes not from always being right, but from not fearing to be wrong..... Mihir..
hi there you should set width of the datagrid to 100% will solve ur prob. :) Confidence comes not from always being right, but from not fearing to be wrong..... Mihir..
hi there use Panel Control instead.... :) Confidence comes not from always being right, but from not fearing to be wrong..... Mihir..
hi all, how do i detect that javascript is enabled on the client's browser or not? thanks in advance Confidence comes not from always being right, but from not fearing to be wrong..... Mihir..
hi all, i have a TextBox control for DateTime input on the Page. i have multiple check on this DateTime control. Like... -Not Null -Valid DateTime -must be greater than some another DateTime -Others also in ASP.Net we have different Validation control to solve it. but i am using CustomValidater to check in one go. i am not understanding how to check DateTime whether it is a valid string or not. if anybody has idea please tell me... Except **try-catch(FormatException)**
thanks in advance Confidence comes not from always being right, but from not fearing to be wrong..... Mihir..