|
Hi,
You can use <asp:HyperLink> and set its Target property to "_blank" and its NavigateUrl property to the file url and done!!!!!!!!!!!!!!!!!.
I hope this will help you.
-- modified at 6:56 Friday 8th June, 2007
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
Chetan Ranpariya wrote: Target property to "_blank" and its NavigateUrl property
Are you suggesting HyperLink Control ?
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Hi,
You r right. I m suggesting you to use hyperlink control.
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
Add the target="_blank" attribute to the link.
|
|
|
|
|
Are you trying to do this after a postback or from a regular link?
Regular link:
<a href="http://www.codeproject.com" target="codeProjectWindow">The Code Project</a>
Code Behind:
You'll need to register a client startup script to open the new window once the page has loaded:
<code>
Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
Page.ClientScript.RegisterStartupScript(Me.GetType, "codeProjectRedirect", "window.open('http://www.codeproject.com')", True)
End Sub
<code>
Hope this helps
Tom
-- modified at 13:41 Friday 8th June, 2007
|
|
|
|
|
Tom John wrote: client startup script to open the new window once the page has loaded:
How will it open if have only path of directory such as C://Albums/FilaName.txt
store at the server side Its not a website page
i think its bit clear now
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Sandeep Akhare wrote: How will it open if have only path of directory such as C://Albums/FilaName.txt
store at the server side Its not a website page
It depends on the MIME type man... Text files normally open directly into the IE.
|
|
|
|
|
Yes but the problem is that the its a web application and client will not be able to open a file untill it is in Virtual directory or it is in current application folder ..........
Link having url of any file in server will not open in this way
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
im using asp.net 2.0+c#
i have a datalist1 as a itemtemplate in a datalist2.
in datalist2 i have an itemtemplate button if i click on that i have to bind the datalist1.hw can i do that dyanmically??
|
|
|
|
|
Hi,
Create an event handler for handling ItemCommand event of datalist as following.
protected void dlst_ItemCommand ( object source, DataListCommandEventArgs e )
{
//Find InnerDatalit.
DataList datalist1 = ( DataList )e.Item.FindControl( "DataList1" );
//Set its datasource
datalist1.DataSource = datasource.
//Bind it.
datalist1.DataBind();
}
This event will call when u click on button in the outer datalist and will find inner datalist and bind it to the data.
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
Thanks its working
|
|
|
|
|
I am creating a custom WebControl. I noticed that it wraps everything in a SPAN tag. How can I get rid of this tag? I don’t want it to appear!
|
|
|
|
|
Override the constructor of the web control and pass in a string representing the tag you want it to be rendered as:
<br />
<DefaultProperty("Text"), ToolboxData("<{0}:TestControl runat=server></{0}:TestControl>")> _<br />
<PartialCaching(10, Nothing, Nothing, "CustomTest")> _<br />
Public Class TestControl<br />
Inherits WebControl<br />
<br />
Public Sub New()<br />
MyBase.New("div")<br />
<br />
End Sub<br />
<br />
Protected Overrides Sub RenderContents(ByVal writer As HtmlTextWriter)<br />
writer.Write("Time Now: " & Date.Now)<br />
End Sub<br />
<br />
End Class<br />
Hope this helps
Tom
|
|
|
|
|
Yes, this allows me to change the tag. But I dont want it changed. I want it completely removed.
|
|
|
|
|
Override the RenderBeginTag and RenderEndTag and just don't call the base method:
<br />
Public Class TestControl<br />
Inherits WebControl<br />
<br />
Protected Overrides Sub RenderContents(ByVal writer As HtmlTextWriter)<br />
writer.Write("Time Now: " & Date.Now)<br />
End Sub<br />
<br />
Public Overrides Sub RenderBeginTag(ByVal writer As System.Web.UI.HtmlTextWriter)<br />
'MyBase.RenderBeginTag(writer)<br />
End Sub<br />
<br />
Public Overrides Sub RenderEndTag(ByVal writer As System.Web.UI.HtmlTextWriter)<br />
'MyBase.RenderEndTag(writer)<br />
End Sub<br />
<br />
<br />
End Class<br />
Hope this helps
Tom
|
|
|
|
|
hi,
I'm trying to convert a VS2003 project to a VS2005.
I'm working under Vista, i'have IIS6 installed in local.
after excuting this line
aspnet_regiis -i -enable
I've try to open my project but I've got this error
Unable to open the Web 'http://localhost/MyProjectFO/Test.csproj'. To access local IIS Web sites, you must install all of the following Windows components: Internet Information Services IIS 6 Metabase and IIS 6 Configuration Compatibility ASP.NET In addition, you must run Visual Studio in the context of an administrator account. By default, Windows runs applications in a limited-privilege user account even when you are logged on to the computer as an administrator. To run Visual Studio with administrative privileges, right-click the Visual Studio icon and then click 'Run as administrator'. For more information, press F1.
thanks for Help!!
|
|
|
|
|
papy-boom wrote: Unable to open the Web 'http://localhost/MyProjectFO/Test.csproj'.
Create a virtual directory as MyProjectFO mapped to the project directory and try to migrate.
|
|
|
|
|
the same problem even in converting the virtual directory into application
|
|
|
|
|
I want to add textboxes on the click of button to the placeholser, i did this by adding this code on the click event of button.
TextBox txtBox = new TextBox();
PlaceHolder1.Controls.AddAt(0, txtBox);
txtBox.ID = "1";
but when i click on another button (on postback), there is no control in placeholder, i did google and found that i need to save state of contorl in viewstate, so after initilization, i can access these controls, but dont know how to implement this, will you please guide me with code snipt which event needs to be override or something else
any help will be highly appriciated.
Many thanks & Best Regards,
adnan
Many Thanks,
Adnan Rafiq
muhammadadnanrafiq@gmail.com
|
|
|
|
|
I would guess you are only adding the controls if Page.IsPostBack = false, you need to add the dynamic controls on every postback, try this:
<br />
Partial Public Class _Default<br />
Inherits System.Web.UI.Page<br />
<br />
Protected Overrides Sub CreateChildControls()<br />
MyBase.CreateChildControls()<br />
<br />
Dim textBox As New TextBox<br />
textBox.ID = "TextBox1"<br />
PlaceHolder1.Controls.Add(textBox)<br />
<br />
Dim button As New Button<br />
button.ID = "Button1"<br />
button.Text = "Click Me"<br />
AddHandler button.Click, AddressOf Button1_Click<br />
PlaceHolder1.Controls.Add(button)<br />
<br />
End Sub<br />
<br />
Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)<br />
<br />
Dim label As New Label<br />
label.ID = "Lable1"<br />
label.Text = "I was just posted back"<br />
PlaceHolder1.Controls.Add(label)<br />
<br />
End Sub<br />
<br />
End Class<br />
Hope this helps
Tom
|
|
|
|
|
Thanks for reply.
It helps me, but not in my current scenrio.
*I want to add controls to placeholder when IsPostBack==True
I have this scenrio: one course can have many dates, and i am inteneded to save course info & dates info on single click event of button.
For that i want to put a placeholder control in the ajax update pannel, and a button to add text box to enter date in it, each time the button is clicked a one more text box should be addto that place holder, and previous text boxes should also retain there values selected by user.
And at the end when i click on save button, i want to get the values of textboxes in placeholder control.
Many Thanks & Best Regards,
Adnan
Many Thanks,
Adnan Rafiq
muhammadadnanrafiq@gmail.com
|
|
|
|
|
The following will do what you are after. It assumes you have a ASPX page with an UpdatePanel containing a PlaceHolder and a Button:
Partial Public Class _Default
Inherits System.Web.UI.Page
Private Property TextBoxCount() As Integer
Get
If ViewState("TextBoxCount") Is Nothing Then
ViewState("TextBoxCount") = 1
End If
Return CInt(ViewState("TextBoxCount"))
End Get
Set(ByVal value As Integer)
ViewState("TextBoxCount") = value
End Set
End Property
Protected Overrides Sub CreateChildControls()
MyBase.CreateChildControls()
For textBoxCounter As Integer = 1 To TextBoxCount
AddButton()
Next
End Sub
Private Sub AddButton()
Dim textBox As New TextBox
textBox.ID = "TextBox" + PlaceHolder1.Controls.Count.ToString
PlaceHolder1.Controls.Add(textBox)
End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
AddButton()
TextBoxCount += 1
End Sub
End Class
I can send you the sample project if you want.
Cheers
Tom
|
|
|
|
|
greetings another wonderful day...
pls i need help on how to disabled control in asp.net 2003? im just new in asp.net2003 pls help..
i used dropdownlist selectindex
thanks
-- modified at 5:04 Friday 8th June, 2007
start a new beginning in every ending; thats what life for......
|
|
|
|
|
ControlName.Enabled = false;
|
|
|
|
|
Hi All,
I want to change the UpdateText of a CommandField(Edit) on runtime in GridView.
For eg:
Now my defalt edit command has UpdateText as Edit. based on a condition i have to change the text to 'Approve'.
kindly some one help me achieve this.
Thanks and Regards,
Biju S.
|
|
|
|