|
Hello
I want to put some downloadable files on my website. Should I use hyperlink on my pages or there is a better way?
Thanks a lot
|
|
|
|
|
If you have the physical files on the server than a hyperlink is the quick and best solution.
Another option is to store/upload the files in database and than stream them to the client.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Well... If the folder that contains the files is within your virtual directory path then you can use it directly.
But remember, This means you are going to open the link for everyone.. Anyone who doesnt have login even can download the file.
Rather than doing so, I like to have files in a secured folder (Say D:\secret) where my website is running in another path(say C:\MyWebSite), or rather files are in another file server which is within the same network say (\\server2\files)
Now when the user clicks on a link, the Onclick Event handler will transmit the file to the client using
Response.TransmitFile() .
|
|
|
|
|
I have an .ascx which contains a listview. Let's call it the parent.
Within its ItemTemplate I reference a second .ascx which is basically another listview, let's call it the child. On the parent, the child control is wrapped in a placeholder tag. I use this place holder tag to show and hide the child.
Psuedo code:
<asp:Placeholder id="plhChild" runat="server" visible="false" >
<uc0:childList id="childListCtl" runat="server" />
</asp:Placeholder>
The child listview has a 'close' button in its Layout Template. Let's call it "btnClose" with an onClick event of "btnClose_Click". I want to use this button to set the visibility of the containing placeholder.
I'm trying to avoid doing something like using
PlaceHolder plhChild = (PlaceHolder)childListCtl.NamingContainer since I can't guarantee every instance of the child .ascx will be contained within a placeholder.
I tried creating an event in the child that could be subscribed to.
Psuedo code:
public delegate CloseButtonHandler();
public event CloseButtonHandler CloseButtonEvent;
And in the actual btnClose_Click(Object sender, EventArgs e) event I have:
if (CloseButtonEvent != null) CloseButtonEvent();
My problem is that the delegate CloseButtonEvent is always null.
I've tried assigning the delegate in the listview's OnDatabound event of the parent and on the click event that set's the plhChild.visible = true, and I've stepped through the code and know the delegate instantiation works in both place, but again, when it gets to the btnClose_Click event on the child, the delegate is null.
Any help would be appreciated.
Neil
|
|
|
|
|
Basically the Placeholder once rendered to the client is just a DIV. So why dont you create btnClose a server side one and just use javascript to change the visibility of the placeholder.
This will eliminate the unnecessary postback of your page. Just in the DataBound event use
btnClose.Attributes.Add("onclick","javascript:yourfunction('" + placeholderId + '");
On your case, as it is a custom delegate defined by you, ASP.NET will not add its handler. Delegates only get object when a function is assigned to it. Use
this.yourclass.CloseButtonEvent += new CloseButtonHandler( put method name here that will handle the event );
Write this in Page_Load.. and as Page_Load is always called first before the actual btnclick event is triggered, the delegate will have the function.
|
|
|
|
|
Hi,
I've successfully loaded an XML file into a TreeView by using the XmlDataSource , which appears to be quite convenient. I can then add and remove items on the TreeView but having called the XmlDataSource.Save() method, my changes are not persisted to the file so when I bind the TreeView back to the XmlDataSource , I lose my changes.
1. I click the "Load" button which initiates the TreeView contents from the XML file by simply calling DataBind() on the TreeView.
2. I then add/edit/delete nodes using suitable buttons and my changes are reflected in the TreeView - that works fine.
3. I click the "Save" button.
I'd expect the XmlDataSource.Save() method to write my TreeView back to the bound data source. I've tried calling BindData() on the XmlDataSource itself but that does nothing.
Any suggestions please?
|
|
|
|
|
bugmenot1234 wrote: I'd expect the XmlDataSource.Save() method to write my TreeView back to the bound data source.
I would ask you to check that if you are getting any exception while performing Save.
I was going through the MSDN [^]documentation of Save method, I found few points which you should consider as it can be used only for following scenarios -
1. The XML data is loaded from an XML file indicated by the DataFile property, not from inline XML data specified in the Data property.
2. No XSLT transformation is specified in the Transform or TransformFile properties.
Also, keep in mind Save does not handle concurrent scenario.
|
|
|
|
|
hi
How can i have the HTML output of the specific .NET control in a page
|
|
|
|
|
behnam_behnam wrote: How can i have the HTML output of the specific .NET control in a page
You need to elobrate your question.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
use
RenderControl(writer) ... where writer is HtmlTextWriter
After the execution of the line writer will hold the html.
|
|
|
|
|
can you explain me by code
|
|
|
|
|
It a function associated with Every control. You can get the Response that the server control will generate from this function.
Check this
MSDN[^]
|
|
|
|
|
Hi,
I have a table 'Tbl1' with 3fields: NidTbl1, NidTbl2,number.
NidTbl1 is primary key and NidTbl2 is a foreign key.
Now how can I get the NidTbl1 which all number fields are greater than 0
Best wishes
|
|
|
|
|
mehrdadc48 wrote: Hi,
I have a table 'Tbl1' with 3fields: NidTbl1, NidTbl2,number.
NidTbl1 is primary key and NidTbl2 is a foreign key.
Now how can I get the NidTbl1 which all number fields are greater than 0
First of all this Question has nothing to do with ASP.NET.
mehrdadc48 wrote: Now how can I get the NidTbl1 which all number fields are greater than 0
Select NidTbl1 from Tbl1 where number >0
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Sorry I went wrong.
I want the NidTbl2 s which ALL number fields are greater than 0
Best wishes
|
|
|
|
|
This is no way related to ASP.Net.
mehrdadc48 wrote: Now how can I get the NidTbl1 which all number fields are greater than 0
Select * From Tbl1 Where NidTbl1 > 0
I would rather suggest you to buy a book and start reading.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Sorry I went wrong,
I meant the NidTbl2 s which all number fields are greater than zero
Best wishes
|
|
|
|
|
You seriously think of buying a book.
mehrdadc48 wrote: Sorry I went wrong,
I meant the NidTbl2 s which all number fields are greater than zero
The only change would be thn:
SELECT * from TBL1 WHERE NidTbl2 > 0
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
I just agree with others who replied your question.
You have already answer for your question.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
hi,
Is there some way in which i can bind the data of the textboxes,dropdownlists in a gridview,make it available for editing and then finally send it to the database.
the user should be able to see all the data that he has entered in the textboxes (temporarily)
|
|
|
|
|
Flavia A wrote: the user should be able to see all the data that he has entered in the textboxes (temporarily)
Gridview having its inbuild features of that. Are you looking for something different ?
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
i guess the data can be retreived from the database in a gridview then the data can be edited and sent back to the database.But what i want is in one form if there are 2 textboxes and 3 dropdown lists the data selected in the dropdown and text boxes should be available in the gridview or something similar for editing before going into the database and later it can go into the database.ie a temprory storage which later gets finalized and then sent to the database.
This is possible in the window application using datagrid.
|
|
|
|
|
See, You can fetch data into DataGrid as u like. U can use templates to put custom controls,just like u told abt textboxes & ddl.After that u can edit the data as u like using ButtonField like features of DataGrid. Is it so in ur way?
|
|
|
|
|
I want to develop status update like facbook's status update.
To do this job I use following technique.
I placed a repeater, textbox and button into a updatepanel. Repeater contain a label to show all status from DB. When a user click on the button, the text will save on DB. And all status( including new) will be shown automatically by repeater after updating database.
Here is my problem: After first clicking text is saved on DB. But page doesn't update with new status. After second click page update with the new status.
Have any problem in my concept? If yes. Plz inform me how can I update the repeater automatically after DB updating .
shahdat
|
|
|
|
|
When you are loading data in Repeater Control ? I guess there is problem related with PostBack.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|