|
No, but you can only run one version of ASP.NET at a time. The easy thing to do is have shortcuts to both copies of aspnet_regiis on your desktop so you can swap between them, or I think some later versions of IIS let you choose the .NET version directly.
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
HMagesh wrote: if i install vs2005, it will corrupt my vs2003?,
The Answer is No.
There won't be any problem. Just go through the installation.
And after installation u have to set per project settings for framework.
The project that are build with 2005 has to set framework 2.0 in IIS.
The same for 2003 to go for Framework 1.1 In iis.
Don't forget to install Framework 2.0 first before installing Visual Studio 2005.
Just try and find any problem then post here.
Believe Yourself™ :->™
|
|
|
|
|
hi HMagesh,
I also faced similar situation. Now i have both vs2003 and vs2005 along with SQL server 2005 in my PC. There is no problem at all at the installation time.
There is no conflict between two versions of VS. Trust me, i am using both.
Hope you work been done.
Thanks & Regards
Dilip Kumar Vishwakarma
|
|
|
|
|
Hi,
I am using some ASP .Net code to allow the user to change the theme (aka, stylesheet) that my website uses, based on a cookie and an imagebutton. It works fine when the domain url has no "www" in it, but as soon as I place it in the URL, the script does nothing at all. I think it calls a post-back and refreshes the page, but beyond that nothing happens. It works in FireFox, but not in IE, from recent testing.
My code is located in the HEAD section of the page, as well.
<br />
<%<br />
<br />
Dim nString As String = "<link href=""templates/stylesheet.css"" rel=""stylesheet"" type=""text/css"" />"<br />
Dim cString As String = "<link href=""templates/stylesheetC.css"" rel=""stylesheet"" type=""text/css"" />"<br />
Dim nImg As String = "images/logo_inverted.png"<br />
Dim cImg As String = "images/logo_normal.png"<br />
Try<br />
Dim themeCookie As String = Request.Cookies("theme").Value<br />
<br />
If themeCookie = "low" Then<br />
Response.Write(nString)<br />
imgLogo.Src = nImg<br />
ElseIf themeCookie = "high" Then<br />
Response.Write(cString)<br />
imgLogo.Src = cImg<br />
Else<br />
Response.Write(nString)<br />
imgLogo.Src = nImg<br />
End If<br />
<br />
Catch ex As Exception<br />
Response.Write(nString)<br />
imgLogo.Src = nImg<br />
End Try<br />
<br />
%><br />
<br />
<script runat="server"><br />
Sub highContrastBtn(ByVal sender As Object, ByVal e As Web.UI.ImageClickEventArgs)<br />
Response.Cookies("theme").Value = "high"<br />
Response.Cookies("theme").Expires = DateTime.Now.AddYears(1)<br />
Page.Response.Redirect(Page.Request.Url.ToString, True)<br />
End Sub<br />
<br />
Sub lowContrastBtn(ByVal sender As Object, ByVal e As Web.UI.ImageClickEventArgs)<br />
Response.Cookies("theme").Value = "low"<br />
Response.Cookies("theme").Expires = DateTime.Now.AddYears(1)<br />
Page.Response.Redirect(Page.Request.Url.ToString, True)<br />
End Sub<br />
</script><br />
I have been working on this for a few hours now, and everything that I try doesn't work. My server is also running the .Net Framework 2.0.
Any help is appreciated.
Thanks,
Mitch
|
|
|
|
|
What a disaster. Why would you put this code in the page and not the code behind ? This gives you no control over when it runs, and is nasty/messy.
Put the script in your code behind where it belongs, set some break points and then you will be able to work out what's going wrong instead of having to guess.
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,
As suggested, I have moved all of my code into the code-behind file.
My head section now looks like:
<link rel="stylesheet" id="style" runat="server" />
And my codefile looks like:
Partial Class _Default<br />
Inherits System.Web.UI.Page<br />
Protected Sub highContrast_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles highContrast.Click<br />
Response.Cookies("theme").Value = "high"<br />
Response.Cookies("theme").Expires = DateTime.Now.AddYears(1)<br />
Page.Response.Redirect(Page.Request.Url.ToString, True)<br />
End Sub<br />
<br />
Protected Sub lowContrast_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles lowContrast.Click<br />
Response.Cookies("theme").Value = "low"<br />
Response.Cookies("theme").Expires = DateTime.Now.AddYears(1)<br />
Page.Response.Redirect(Page.Request.Url.ToString, True)<br />
End Sub<br />
<br />
Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit<br />
Dim nString As String = "templates/stylesheet.css"<br />
Dim cString As String = "templates/stylesheetC.css"<br />
Dim nImg As String = "images/logo_inverted.png"<br />
Dim cImg As String = "images/logo_normal.png"<br />
<br />
Try<br />
Dim themeCookie As String = Request.Cookies("theme").Value<br />
<br />
If themeCookie = "low" Then<br />
style.Href = nString<br />
imgLogo.Src = nImg<br />
ElseIf themeCookie = "high" Then<br />
style.Href = cString<br />
imgLogo.Src = cImg<br />
Else<br />
style.Href = nString<br />
imgLogo.Src = nImg<br />
End If<br />
<br />
Catch ex As Exception<br />
style.Href = nString<br />
imgLogo.Src = nImg<br />
End Try<br />
End Sub<br />
End Class
However, I am still experiencing the same issue. Do you have any other suggestions? (I have also tried putting my code into Init, Load, and now PreInit, and nothing seems to change the result.) I am beginning to believe this is a problem with IE, because FF works fine.
Thanks,
Mitch
|
|
|
|
|
I have another small update to make.
Inside my Click event handler, I can change the stylesheet by using,
style.Href = nString<br />
imgLogo.Src = nImg
, it just seems like Internet Explorer is refusing to let me set the cookie when I have the WWW in the URL. Is there a setting that I am forgetting to set?
Thanks,
Mitch
|
|
|
|
|
Hi!
I have wasted lots of time. could someone please advise if its possible or not so that i could start thinking of alternative solution. I am trying to build a tree level datagrid. the datastructure looks something like below.
1 Vehicle
2 Clothing
1 Holden
2 Pants
1 Barina
2 Astra
3 Jeans
4 Cotton
ASPX
<asp:DataGrid id="dgA" DataKeyField="aid" runat="server" Width="100%" AutoGenerateColumns="False">
<Columns>
<asp:BoundColumn DataField="aid" HeaderText="Id" Visible="false"></asp:BoundColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:ImageButton id="btnA" runat="server" Width="9px" Height="9px" ImageUrl="/Images/Plus.gif" CommandName="ExpandA"></asp:ImageButton>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="aname" HeaderText="Name"></asp:BoundColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:PlaceHolder ID="phExpandA" Runat="server" Visible="False">
</td></tr>
<tr><td > </td>
<td colspan="11">
<asp:DataGrid id="dgB" DataKeyField="bId" runat="server" Width="100%" AutoGenerateColumns="False">
<Columns>
<asp:BoundColumn DataField="bid" HeaderText="Id" Visible="false"></asp:BoundColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:ImageButton id="btnB" runat="server" Width="9px" Height="9px" ImageUrl="/Images/Plus.gif" CommandName="ExpandB"></asp:ImageButton>
</ItemTemplate>
</asp:TemplateColumn> <asp:BoundColumn DataField="bname" HeaderText="Name"></asp:BoundColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:PlaceHolder ID="ExpandB" Runat="server" Visible="False">
</td></tr>
<tr><td > </td>
<td colspan="11">
<asp:DataGrid ID="dgC" runat="server" Width="100%" AutoGenerateColumns="False">
<Columns>
<asp:BoundColumn DataField="cId" HeaderText="Id" ItemStyle-Wrap="true">
</asp:BoundColumn>
<asp:BoundColumn DataField="cName" HeaderText="Name" ItemStyle-Wrap="true">
</asp:BoundColumn>
</Columns>
</asp:DataGrid>
</asp:PlaceHolder>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
</asp:PlaceHolder>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
VB
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim conn As New SqlConnection("...")
Dim cmd As SqlCommand = conn.CreateCommand()
Dim dsA As New DataSet
Dim daA As SqlDataAdapter
cmd.CommandText = "select * from A"
conn.Open()
daA = New SqlDataAdapter(cmd.CommandText, conn)
daA.Fill(dsA)
If Not dsA Is Nothing Then
'fill parent datagrid
If Not IsPostBack Then
dgA.DataSource = dsA
dgA.DataBind()
End If
End If
End Sub
Private Sub dgA_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgA.ItemDataBound
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
Dim dgGridB As DataGrid = CType(e.Item.FindControl("dgB"), DataGrid)
AddHandler dgGridB.ItemCommand, AddressOf dgGridB_ItemCommand
Dim conn As New SqlConnection("...")
Dim cmd As SqlCommand = conn.CreateCommand()
Dim dsB As New DataSet Dim daB As SqlDataAdapter
cmd.CommandText = "select * from B"
conn.Open()
daB = New SqlDataAdapter(cmd.CommandText, conn)
daB.Fill(dsB)
If Not dsB Is Nothing Then
dgGridB.DataSource = dsB
dgGridB.DataBind()
End If
End If
End Sub
Private Sub dgA_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgA.ItemCommand Select Case e.CommandName
Case "ExpandA"
Dim img As ImageButton img = e.Item.Cells(1).FindControl("btnA")
If img.ImageUrl = "/Images/Plus.gif" Then
img.ImageUrl = "/Images/Minus.gif"
Else
img.ImageUrl = "/Images/Plus.gif"
End If
Dim phExpandSummary As PlaceHolder
phExpandSummary = e.Item.Cells(1).FindControl("phExpandA")
phExpandSummary.Visible = Not phExpandSummary.Visible
End Select
End Sub
Private Sub dgGridB_ItemCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs)
'TODO
Select Case e.CommandName
Case "ExpandB"
Dim img As ImageButton img = e.Item.Cells(1).FindControl("btnB")
If img.ImageUrl = "/Images/Plus.gif" Then
img.ImageUrl = "/Images/Minus.gif"
Else
img.ImageUrl = "/Images/Plus.gif"
End If
Dim phExpandSummary As PlaceHolder
phExpandSummary = e.Item.Cells(1).FindControl("phExpandB")
phExpandSummary.Visible = Not phExpandSummary.Visible
End Select
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
Dim dgGridC As DataGrid = CType(e.Item.FindControl("dgC"), DataGrid)
Dim conn As New SqlConnection("...")
Dim cmd As SqlCommand = conn.CreateCommand()
Dim parentDS As New DataSet
Dim parentDA As SqlDataAdapter
cmd.CommandText = "select * from C"
conn.Open()
parentDA = New SqlDataAdapter(cmd.CommandText, conn)
parentDA.Fill(parentDS)
If Not parentDS Is Nothing Then
'fill parent datagrid
If Not IsPostBack Then
dgGridC.DataSource = parentDS
dgGridC.DataBind()
End If
End If
End If
End Sub
|
|
|
|
|
|
hi thanks but all of them are only for two level grid navigation and upto 2 level mine works perfectly. the problem is when i need to fire an event from datagrid B so that I can populate datagrid C.
please help
|
|
|
|
|
It's the same technique whether it is two levels or 12 levels! Buy a third party control then, like Telerik or Infragistics.
only two letters away from being an asset
|
|
|
|
|
thanks for your reply. could you just please tell me how could i fire my event dgGridB_ItemCommand ?
|
|
|
|
|
i am using this to redirect
GridView2.DataSource = dummy_rules;
GridView2.DataBind();
foreach (GridViewRow row in GridView2.Rows)
((LinkButton)row.Controls[0].Controls[0]).Attributes.Add("onclick", "window.showModalDialog('CreateRule.aspx?new=editM',null, 'status:no;dialogWidth:555px;dialogHeight:425px;di alogHide:true;help:no;scroll:no')");
the dialog box appears but i need the gridview there.........but when i use Prevouspage it throws exception Object reference not set to an instance of an object
i have added the directive
]]>;
|
|
|
|
|
What do you mean, "the dialog box appears but i need the gridview there"? You want a gridview in the createrules.aspx page that appears in your modalDialog? What are you trying to accomplish with the PreviousPageType, and why is it in a CDATA ?
only two letters away from being an asset
|
|
|
|
|
i have added
%@ PreviousPageType VirtualPath ="~/StartPage.aspx" %
in my dialog page
i want to access Gridview of StartPage.aspx which is the previous page but in the dialog page the previous page is null
Thanks
|
|
|
|
|
Do you need to access the control or the data in the control? PreviousPage is of course going to be null because you are opening the page via a JavaScript function. There is no Postback occurring for ASP.NET to set the value.
only two letters away from being an asset
|
|
|
|
|
i want to access the data of the gridview controll.
|
|
|
|
|
Then call the same method you use to populate the grid on the first page.
only two letters away from being an asset
|
|
|
|
|
i want to get column2 value of the selected row on startPage.aspx
|
|
|
|
|
So pass the id of the row as a querystring to the page you are trying to open. Then get the data and access that row. It really isn't as difficult as you are trying to make it.
only two letters away from being an asset
|
|
|
|
|
thanks
but the actual problem is this i have a number of controls not only the gridview...... i thought there may be a way to access values of controls instead of passing values of all the controls in querystring
|
|
|
|
|
PreviousPage property of the page is set only if it is requested as a result of cross page post-back. In your case you are redirecting from the other page using modal dialog or smth like that. To have a cross page post back you can set PostBackUrl property of your LinkButton to the second page instead of setting onclick handler as an attribute. However in this case you won't have the modal dialog.
|
|
|
|
|
Hi, I'm trying to insert some text from the page's QueryString into a LayoutTemplate inside a ListView, but something so seemingly simple is proving to be very difficult (for me, at least). Here's the code I have for my LayoutTemplate:
<LayoutTemplate>
<h1><%# Request.QueryString["itemtype"] %> Items</h1>
<asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
</LayoutTemplate>
The problem is that only "Items" shows up. I have also tried the <%= tag, but then it tells me the control cannot be modified because it contains code blocks. I'm running out of ideas, so any help would be greatly appreciated. Thanks.
modified on Monday, February 11, 2008 8:46 PM
|
|
|
|
|
I'm not a fan of this asp-style coding so I can't really help you unless you're willing to use the asp.net-style code-behind feature... but if you are, run the heading tag on the server and set it's text programmatically:
.aspx:
<h1 id="heading" runat="server" />
Code-behind (.aspx.cs or .vb or ... - I choose C#):
void Page_Load(object sender, EventArgs e)
{
heading.InnerHtml = Request.Params["itemtype"] + " Items";
}
Notice that this solution has the additional benefit of protecting against script injections because the parameter will be interpreted as HTML code, not just literal text. Hence, a user putting
p.aspx?itemtype=<script>close()</script>
in the adress bar (or more problematically, manages to save an itemtype named so the database, causing other users to be directed to such a url) will render the > and < characters as > and < hence just displaying the text rather than execute the script!
|
|
|
|
|
Hi,
we're making use of the CallContext class (System.Remoting.Runtime.Messaging.CallContext) to easily share information among objects participating in the same threads. We have a base page class from which we derive our pages, and we initialize this context by handling the Init event in the base page. This seems to work rather brilliantly.
Just to be sure: It is reasonable, isn't it, to assume that this would either *always* work or *never* work? In other words, since the callcontext travels along the logical thread, the init event will never be executed on a different thread from other events in ASP.NET?
|
|
|
|