|
Hi, I have a rather stupid question, hope someone can help me.
I am writing a webpage in C#, in VS.NET 2003.
To make things easier I used some user controls.
However, my question how can I access the controls in the webpage.
Let's say I have my aspx page A, and user control B that is within the aspx page A. I have a textbox in the User control B. And I want to pass the value of the textbox to another page from a Button in Aspx page A.
The regular approach of Session["textboxvar"]=TextboxB.Text simply doesn't work. VS.NET 2003 is complaining "The type or namespace name 'TextboxB' could not be found."
How can I access it?
Many, many thanks!!!
|
|
|
|
|
First of all, don't use the session if you can avoid it. You have user controls. You can put two controls on the same page, and switch which one is visible, and then viewstate will hold the values for you. you can also pass values on the URL.
TextboxB exists in the user control, so that's where you need to write the code to interact with it. You can also use delegates to get your user controls to call code in other controls or the main page.
Christian Graus
Please read this if you don't understand the answer I've given you
"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 )
|
|
|
|
|
a simple solution is write a public method in user control which returns the textbox value like
public string GettbValue(){ return this.Textbox.Text;}
and access this method in ur aspx page by using
B.GettbValue() method and send it using querystring...
i hope this will help you
thanks,
deep.
|
|
|
|
|
May as well make this a property.
Christian Graus
Please read this if you don't understand the answer I've given you
"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 )
|
|
|
|
|
I have been doing C# (WinForms) development for the past 5 years. I have just started an ASP project. From my experience I have always programmed to type safe objects that implemented the needed interfaces to allow generics. The current projects is using DataTables as the primary object for storing all information and does not use type safe objects that implement generic interfaces. Today, I had a discussion with the programmer who wrote the system that uses only tables and was unable to give him a list of the true benefits that type safe objects using generics provide. Can anyone list what advantage using the type safe objects have over using table objects handling everything.
Thanks,
Steve
|
|
|
|
|
I want to set Data from a row in a DataGrid into independent text boxes. I mean each column of the Grid into respective Text Boxes, based on selected row. This is to enable me edit such row.
|
|
|
|
|
you just need to code the logic in the select command of grid view..... mak sure to assign field for datakeyfield property of grid
flow will be like :->
1. get the value of selectedkey field (data key field)
2. fetch data from cache/database for that particular field value
3. set the value to the appropriate text boxes.
[you can even read the value from grid columns if u don't want to fetch data from database.. use findcontrol("name_of_the_label") or cells[0].controls[0].toString();]
cheers !
Ashish Sehajpal
|
|
|
|
|
Hello Friends
I am having 4 aspx pages ....
First one is admin.aspx
second one is controller.aspx
third one is booking.aspx
Fourth one is Login.aspx
now either the admin or a normal user when goes to the website ..first page appears is login.aspx
for example www.codeproject.com/login.aspx
for normal user it redirects to booking.aspx and for admin it redirects to controller.aspx
for example if the user types something like www.codeproject.com/admin.aspx then how to recognise that the person is admin and coming from the login page ...should i use session variables for this ?
how to restrict anonymus users going to that page ....
Do everyone follows the same logic or different
Thank you
(The whole story above is written in brief for understanding of new programmers like me Experts avoid reading all the things please do reply)
Dont Get Paid for the Hours you worked, Get Paid for the Work You Have Done in an Hour.
|
|
|
|
|
how u can detect without login that someone is simple user or admin ?
{there may be a case that you set a cookie with rolename and check that cookie. but again, for creating a cookie, user needs to login once under his/her role.}
else wise for other situation you can opt for using FORMS authentication using ticket and setting the permission to particular role to access and directory or individual url.
if the ticket is having admin user logged in and then opening the URl will be allowed under admin section, else the user wil be redirected to admin login page.
Ashish Sehajpal
|
|
|
|
|
First you need to authenticate a user (find out who they are) and then each time they attempt to access a restricted resource you need to authorized (find out if they are allowed to access the resource). Authentication is performed when the user first visits the site, and then the user is assigned some sort of ticket that follows them as they navigate the site and identifies who they are. If the user does not have a ticket they have not been authenticated and must be redirected to the login.
I also suggest reading up on Authentication and Authorization for ASP.NET, just search for Asp.net Authentication Authorization.
http://www.google.com/search?hl=en&rls=com.microsoft%3Aen-US&q=asp.net+authentication+authorization[^]
|
|
|
|
|
Mark
I love li li huang ,
ha ha ,
but you don't who is she!
|
|
|
|
|
Hi I just started a new job where they have used foxweb for WEB development for years
I have to start adding links to that website.I need to develop
those links in ASP.Net since they are planning to migrate the site evetually to ASP.Net
When i submit a link i can open the .net page but i cannot pass the variable from the
querystring or URL link please Any help would be apreciated .
thanks in advance
modified on Monday, April 28, 2008 12:14 PM
|
|
|
|
|
I want to add a banner into a master page. that banner has this extention .swf (for example: baneer.swf which is a flash) What is the code that I have to write to add this banner and make it work in the master page. Please if you can give good description of how to do it because I am new in this filed.
Thank you in advance for your help.
Best regards,
|
|
|
|
|
There is nothing special about adding a flash in a master page, just put the code in the page as with any other page.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
use following code.... replace the movie name from "/images/banner.swf" to your banner file
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="800" height="308" id="container" align="middle">
<param name="movie" value="/images/banner.swf" />
<param name="quality" value="high" />
<embed src="/images/banner.swf" quality="high" bgcolor="#ffffff" width="959" height="328" name="container" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
cheers !
Ashish Sehajpal
|
|
|
|
|
Hey my answer may be peculiar but the way in which i did this thing is added the url inside the Frames and everything worked fine ,,, i dont know whether it is correct or not ..but it works Try it ...
Dont Get Paid for the Hours you worked, Get Paid for the Work You Have Done in an Hour.
|
|
|
|
|
There is nothing called
Ashish Sehajpal wrote: <embed src="/images/banner.swf" quality="high" bgcolor="#ffffff" width="959" height="328" name="container" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
in the MasterPage. I mean it is not a property.
Is there any solution???!
Thanks for your help,but it is not working.
|
|
|
|
|
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,79,0"
id="Object1" width="490" height="352">
<param name="movie" value="images/movie.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#FFFFFF" />
<embed name="ad2" src="images/movie.swf"
quality="high" bgcolor="#FFFFFF" swLiveConnect="true"
width="490" height="352"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>
</object>
put this tag as it is in HTML SOURCE where you need to put that banner....
it is working dear..
<param name="movie" value="images/movie.swf" />
and
<embed name="ad2" src="images/movie.swf"
change the value/src to simply point towards your SWF file...
try it ....plz
Ashish Sehajpal
|
|
|
|
|
Thanks again, but it Visual Studio (VS) gives me a red line below embed. It is VS is not recognizing it. It says [ Validation(XHTML 1.0 transitional): Element 'embed' is not supported.]. I don't now what to do.
My master page code is as follows:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage5.master.cs" Inherits="MasterPage5" %><br />
<br />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br />
<br />
<html xmlns="http://www.w3.org/1999/xhtml" ><br />
<head runat="server"><br />
<title>Untitled Page</title><br />
</head><br />
<body><br />
<form id="form1" runat="server"><br />
<div><br />
<br />
<table border="0" cellpadding="0" cellspacing="0" style="z-index: 100; left: 0px;<br />
width: 100%; position: absolute; top: 0px; height: 100%"><br />
<tr><br />
<td rowspan="4" style="width: 8%"><br />
margine</td><br />
<td rowspan="4" style="width: 6px"><br />
h</td><br />
<td colspan="2" style="height: 15%; width: 80em" id="kfupmlogo"><br />
<br />
logo<br />
<div style="width: 100px; height: 100px"><br />
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"<br />
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,79,0"<br />
id="Object1" width="700" height="100"><br />
<param name="movie" value="images/logo.swf" /><br />
<param name="quality" value="high" /><br />
<param name="bgcolor" value="#FFFFFF" /><br />
<embed name="ad2" src="images/logo.swf"<br />
quality="high" bgcolor="#FFFFFF" swLiveConnect="true"<br />
width="490" height="352"<br />
type="application/x-shockwave-flash"<br />
pluginspage="http://www.macromedia.com/go/getflashplayer"></embed><br />
</object><br />
<br />
</div><br />
</td><br />
<td rowspan="4" style="width: 1%; height: 3%">h<br />
</td><br />
<td rowspan="4" style="height: 3%; width: 13%"><br />
margine</td><br />
</tr><br />
<tr><br />
<td colspan="2" style="height: 6px"><br />
naviagation</td><br />
</tr><br />
<tr><br />
<td style="width: 10%; height: 242px"><br />
menu</td><br />
<td style="width: 78%; height: 242px"><br />
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"><br />
</asp:ContentPlaceHolder><br />
</td><br />
</tr><br />
<tr><br />
<td colspan="2" style="height: 3%; width: 80%"><br />
footer</td><br />
</tr><br />
</table><br />
</div><br />
</form><br />
</body><br />
</html><br />
Thanks again for your help.
|
|
|
|
|
no issues...
you save it and close the master form . now run the application without caring about any error and check whether it works or not.
[and you have created a div with 100X100 px area...and your SWF movie object's size is 800X600 px... take a look and set it accordingly. EMBED tag is for mozilla fireforx support. if it doesn't recognize you can even remove the embed tag .]
Ashish Sehajpal
|
|
|
|
|
Thanks again for your help and effort.
I have done what you have just said, but it didn't work. I have tried it with both Firefox and Internet Explorer. I shows me the box (width and hiegh), but without showing the banner (content of the banner or the flash).
Is it working with you?
|
|
|
|
|
ah !
yes i have faced that problem once....that was the problem of faulty publishing of flash movie...
currently this ocde is working very fine with me...i have used it on live site...
try using some other SWF movie....[download from internet]
try this code..... save it as test.html and run this...if it works fabulous then try changing the name of your images/logo.swf with http://www.xpressions-snap.com/images/xflash.swf
<html><body><br />
<br />
<br />
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"<br />
<br />
<br />
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,<br />
<br />
0,79,0"<br />
id="Object1" width="490" height="352"><br />
<param name="movie" <br />
<br />
value="http://www.xpressions-snap.com/images/xflash.swf" /><br />
<param name="quality" value="high" /><br />
<param name="bgcolor" value="#FFFFFF" /><br />
<embed name="ad2" <br />
<br />
src="http://www.xpressions-snap.com/images/xflash.swf"<br />
quality="high" bgcolor="#FFFFFF" swLiveConnect="true"<br />
width="490" height="352"<br />
type="application/x-shockwave-flash"<br />
<br />
<br />
pluginspage="http://www.macromedia.com/go/getflashplayer"></embed><br />
</object><br />
<br />
</body></html>
Ashish Sehajpal
|
|
|
|
|
do u have adobe dreamweaver installed ?
if not then downoad it and install..... it will complete your job very easily...as it will automatically generate the appropriate HTML code if you just insert the SWF file at any point in your form (same as in MS-Word you choose to insert any image to be inserted into the page...)
Ashish Sehajpal
|
|
|
|
|
I will install it and I will try it. 1000s of thanks.
|
|
|
|
|
Hey guys
I have been using URL Rewriter available at: MSDN[^]. I want to rewrite subdomains now. For example...
http://adam.sitename.com/index.aspx ---should map to---> http://www.sitename.com/index.aspx?user=adam
|
|
|
|