|
Please don't create multiple post for the same question.
Apurva Kaushal
|
|
|
|
|
hi frd...this is code for upload image.....
string sPath;
sPath="../Images/Logo.jpg";
if(BuildersLogoFile.PostedFile!=null)
{
HttpPostedFile photoFile=BuildersLogoFile.PostedFile;
int photoLength=photoFile.ContentLength;
string fileName=Path.GetFileName(photoFile.FileName);
if(photoLength==0)
{
Label1.Text="There was not any file uploaded";
return;
}
if(File.Exists(Server.MapPath(sPath+fileName)))
{
Label1.Text="File already exists";
return;
}
if(Path.GetExtension(photoFile.FileName).ToLower()!=".jpg")
{
Label1.Text="The file must have extension of JPG";
return;
}
byte[] myData=new byte[photoLength];
photoFile.InputStream.Read(myData,0,photoLength);
int file_append=0;
while (System.IO.File.Exists(Server.MapPath(sPath + fileName)))
{
file_append++;
fileName = System.IO.Path.GetFileNameWithoutExtension(photoFile.FileName) + file_append.ToString() + ".jpg";
}
FileStream newFile=new FileStream(Server.MapPath(sPath+fileName),FileMode.Create);
newFile.Write(myData,0,myData.Length);
newFile.Close();
buildersClass.BuildersLogo=sPath+fileName;
}
Vijay
|
|
|
|
|
iam setting a grid view in a panel and iam having a text box when i enter some text in the text box i wrote a code in a such a way that the text box value should come in the grid view..by using view state its working fine ..and the iam viewing the last genarated row of the grid view ..but the pproblem was when grid view becomming larger the scroll bar of panel is appearing and iam uanable to view the last genarated row its going down in the pannel...how this problem solve...will some one help for me...plz
|
|
|
|
|
jagadeeshkumar2106 wrote: iam uanable to view the last genarated row its going down in the pannel..
How come you are not able to view?? You mean, you don't want to scroll down to view the last row?? then, you can set the scroll position of your DIV from Javascript.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
"Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."
|
|
|
|
|
my intension is the grid view row is added at the last and it is coming from the top of the panel ...is there is any way to come from the bottom of the panel and the auto genarate to come at the top...
|
|
|
|
|
As Apurva suggested, you can sort your data in descending order. or try to insert the new row at the top of your datatable. (dt.Rows.InsertAt() )
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
"Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."
|
|
|
|
|
dt.Rows.InsertAt() how to work with this will u help me plz
|
|
|
|
|
If you just want to see the last inserted record without scrolling then you can show that at first and it will be displayed at the top.
Apurva Kaushal
|
|
|
|
|
hi wat u said i think it will com but will u plz help how to get the grid in reverse order madam
|
|
|
|
|
You can sort your records based on the ID column (if you have) in descending order or by the created date again in descending order.
jagadeeshkumar2106 wrote: reverse order madam
I am a Male dude...
Apurva Kaushal
|
|
|
|
|
sory sir for calling mam .... actually iam having columns whic are string data type ...
|
|
|
|
|
You can have one more column for ID and can make that column auto generated and sort it accordingly.
Apurva Kaushal
|
|
|
|
|
sir will u guide me how to do now i created a row with a id wehn a new row is genarated it is getting 1,2,3,.... now plz gudie with code how to sort the auto genrated columns
|
|
|
|
|
You can do it some how like this:
string strExpr;<br />
string strSort;<br />
<br />
strExpr = "id > 5";<br />
strSort = "name DESC";<br />
DataRow[] foundRows = <br />
customerTable.Select( strExpr, strSort, DataViewRowState.Added );
Apurva Kaushal
|
|
|
|
|
sir will u guide me how to do now i created a row with a id wehn a new row is genarated it is getting 1,2,3,.... now plz gudie with code how to sort the auto genrated rows
|
|
|
|
|
can anyone help me to upload the image file in my project folder
|
|
|
|
|
Ravi_21 wrote: my project folder
You can only upload the file to Web server.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
"Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."
|
|
|
|
|
sir so tell me the code for the file upload in the server
|
|
|
|
|
If you just want to ask something from a particular person then reply to his thread.
Apurva Kaushal
|
|
|
|
|
You can take help from Here[^] for uploading a file.
Apurva Kaushal
|
|
|
|
|
Hi need to create navigation that gets populated via database and is role based. below is the sql
CREATE TABLE [TopMenu] (
[MenuID] [int] IDENTITY (1, 1) NOT NULL ,
[Text] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Description] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[ParentID] [int] NULL ,
CONSTRAINT [PK_Menu] PRIMARY KEY CLUSTERED
(
[MenuID]
) ON [PRIMARY]
) ON [PRIMARY]
GO
INSERT INTO TopMENU
Select 'Property','Property', NULL
UNION ALL Select 'Portfolio','Portfolio', NULL
UNION ALL Select 'Capital Expenditure','PortfolioCapex', 1
UNION ALL Select 'Depreciation','PortfolioDepreciation', 1
UNION ALL Select 'Condition Audit','PortfolioCondition', 1
UNION ALL Select 'Historical Expenditure','PortfolioHisEx', 1
UNION ALL Select 'Property Details','PropertyDetail', 2
UNION ALL Select 'Assets','PropertyAsset', 2
UNION ALL Select 'Depreciation','PropertyDepreciation', 2
UNION ALL Select 'Capital Expenditure','PropertyExpenditure', 2
UNION ALL Select 'Insurance','PropertyInsurance', 2
UNION ALL Select 'Documents','PropertyDocuments', 2
UNION ALL Select 'Capex','PortfolioCapex', 3
UNION ALL Select 'Graph','PortfolioCapexGraph', 3
UNION ALL Select 'Graph','PortfolioDepreciationGraph', 4
UNION ALL Select 'Current Depreciation','PortfolioDepreciation', 4
UNION ALL Select 'WDV & Depreciation','PortfolioDepreciationWDV', 4
UNION ALL Select 'Assets','PropertyAsset', 8
UNION ALL Select 'Capex','PropertyCapex', 8
UNION ALL Select 'Depreciation','PropertyDepreciation', 8
UNION ALL Select 'Condition','PropertyCondition', 8
UNION ALL Select 'Expenditure','PropertyExpenditure', 8
UNION ALL Select 'Disposed','PropertyDisposed', 8
UNION ALL Select 'Capital Ex','PropertyExpenditure', 10
UNION ALL Select 'Capital Ex Graph','PropertyExpenditureGraph', 10
GO
now clearly, I will have two top level navigation
property and portfolio. both property will have subsequent navigation and those subsequest navigation may or may not have another sets of navigation.
I need to display in a row style not in a drop down style for eg. If I am in portfolio link the navigation structure should be as below
Portfolio
Capital Expenditure | Depreciation | Condition Audit | Historical Expenditure
Capex | Graph
by default Capex should be selected. it should also highlight Portfolio, Capital Expenditure and Capex as Capex's parent is Capital Expenditure and Portfolio
I was thinking of using a 3 level datagrid. could someone please help me I am using asp.net 2.0 web application project with vb.net and sql server 2005
thanks in advance
|
|
|
|
|
|
Hope you can help me in this problem. I have a textbox that is used to search values in a grid. That is, if i type a key in textbox all rows starting with what i have typed in text box should only be there in the grid. I know its easy in Vb.net. the textchanged event of the textbox will help. In ASP.net this event gets fired only when we go out of the textbox not at the instant we type a key.Is there any solution for this?
|
|
|
|
|
Hi,
You need to use callback to server.
you need to use AJAX. A good option is to use microsoft's implementation of AJAX(codename ATLAS).
Check here: http://ajax.asp.net/
|
|
|
|
|
Hello,
The customer wants to download a music file for a path that is on the server, then play that in the web form. So it will be like having window media player embedded in the web form itself.
I have the code for downloading and playing. However, a dialog will popup and when they click open it will play the music. However, the customer doesn't like this and want to play the music in a player that is in the web page itself.
Here is my code so far for downloading and playing the music.
Many thanks
<br />
Try<br />
Dim fs As FileStream = Nothing<br />
Dim contentType As String = String.Empty<br />
'Dim path As String = "\\10.10.10.31\Inetpub\wwwroot\csone\images\Content\"<br />
'Dim fileName As String = "Voice.mp3"<br />
Dim path As String = "C:\DownloadPicture\"<br />
Dim fileName As String = "Beethoven.wma"<br />
<br />
<br />
fs = File.Open(path & fileName, FileMode.Open)<br />
Dim fileBytes(fs.Length) As Byte<br />
<br />
fs.Read(fileBytes, 0, fs.Length)<br />
fs.Close()<br />
<br />
Response.AddHeader("Content-disposition", "attachment; filename=" & fileName)<br />
Response.ContentType = "application/octet-stream"<br />
Response.BinaryWrite(fileBytes)<br />
HttpContext.Current.ApplicationInstance.CompleteRequest()<br />
<br />
Catch ex As Exception<br />
MsgBox(ex.Message)<br />
End Try
|
|
|
|
|