473,770 Members | 6,105 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Expert Opinions - Doc Obj

JJ
Hi,

I am working on a proj and was thinking of creating a Document object
that would hold filepath and doc name. And in this Document obj. when
page that is using it loads I would call a document obj method to
initialize the following javascipt:

<code>
if (new FileInfo(String .Format("{0}.pd f", strFile)).Exist s)
{
string strJScript = String.Format(@ "
<script language='javas cript'>
function lnkLV_OnClick()
{{
window.open('{0 }', '_blank', 'scrollbars=no, toolbar=no,loca tion=no,
directories=no, status=yes, menubar=no, resizable=yes') ;
return false;
}}
</script>
", Server.UrlEncod e(strFile));
lnkLV.Attribute s.Add("onClick" , "return lnkLV_OnClick() ;");
Page.RegisterCl ientScriptBlock ("lnkLV_OnClick ", strJScript);
}
</code>

So this code basically adds an "OnClick" link button event and
registers the javascript. Now there is multiple times on the page that
uses this same identical code so I thought I would add it to a document
class and then call a method to activate the links one by one. So my
question is how can I make this generic in the document class? I would
need to pass linkbutton in question to the method. How could I pass the
refering page to the method so I can RegisterClientS criptBlock
effectivily?

Also since I have multiple documents and each one would be associated
with a link button. How would I store these document names? What I am
not sure of is should I create just one document obj and use some
technique to store document filenames in that one obj. like in an
arraylist?
Thanks,

JJ

Feb 7 '06 #1
1 1123
Hi JJ,
question is how can I make this generic in the document class? I would
need to pass linkbutton in question to the method. How could I pass the
refering page to the method so I can RegisterClientS criptBlock
effectivily?
The answer to your first question is easy:

You can create a static method that takes a button as an argument. To get
the reference to the Page, you can either pass that as an argument, or use
(System.Web.UI. Page)System.Web .HttpContext.Cu rrent.Handler.
Also since I have multiple documents and each one would be associated
with a link button. How would I store these document names? What I am
not sure of is should I create just one document obj and use some
technique to store document filenames in that one obj. like in an
arraylist?
The answer to your second question is not possible to give you until you
explain your requirements.

Note that your entire post doesn't mention anything about your requirements,
only your solution. In order to know how to design an application, one must
know the requirements.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
We got a sick zebra a hat,
you ultimate tuna.
"JJ" <jj****@hotmail .com> wrote in message
news:11******** *************@g 44g2000cwa.goog legroups.com... Hi,

I am working on a proj and was thinking of creating a Document object
that would hold filepath and doc name. And in this Document obj. when
page that is using it loads I would call a document obj method to
initialize the following javascipt:

<code>
if (new FileInfo(String .Format("{0}.pd f", strFile)).Exist s)
{
string strJScript = String.Format(@ "
<script language='javas cript'>
function lnkLV_OnClick()
{{
window.open('{0 }', '_blank', 'scrollbars=no, toolbar=no,loca tion=no,
directories=no, status=yes, menubar=no, resizable=yes') ;
return false;
}}
</script>
", Server.UrlEncod e(strFile));
lnkLV.Attribute s.Add("onClick" , "return lnkLV_OnClick() ;");
Page.RegisterCl ientScriptBlock ("lnkLV_OnClick ", strJScript);
}
</code>

So this code basically adds an "OnClick" link button event and
registers the javascript. Now there is multiple times on the page that
uses this same identical code so I thought I would add it to a document
class and then call a method to activate the links one by one. So my
question is how can I make this generic in the document class? I would
need to pass linkbutton in question to the method. How could I pass the
refering page to the method so I can RegisterClientS criptBlock
effectivily?

Also since I have multiple documents and each one would be associated
with a link button. How would I store these document names? What I am
not sure of is should I create just one document obj and use some
technique to store document filenames in that one obj. like in an
arraylist?
Thanks,

JJ

Feb 7 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

35
3226
by: jerrygarciuh | last post by:
Hi all, I was just wondering what popular opinion is on PHP giving this warning: Warning: Invalid argument supplied for foreach() in /home/boogerpic/public_html/my.php on line 6 when presented with an indefined variable. It makes sense to me to warn if an unacceptably defined var is passed but it
2
3205
by: Kari Laitinen | last post by:
During the past 15 years I have been writing computer programs with so-called natural names, which means that the names (identifiers, symbols) in progarms are constructed of several natural words. I have even written a C++ book in which all programs are written with natural names. More information and free pages of the book can be found at http://www.naturalprogramming.com/cppbook.html I'm planning to produce similar books with the C#...
4
1738
by: Tony Houghton | last post by:
Can anyone recommend a good book for intermediate up to expert level? I'm an experienced C programmer and I learnt Python from the "Learning Python" O'Reilly book because it had good reviews. I was disappointed though. It was difficult to read because it was so verbose. It would sometimes take more than a page to explain something where all the information I needed could have been conveyed in one sentence. If anyone's seen Leendert...
3
2138
by: Jack Klein | last post by:
I'm looking for opinions on a C technique I, and others, have used successfully in the past. While some people swear by, apparently others swear at it. Assume a part of a program too large to fit comfortably in a single source file, call it a "module". Let's call it "module A". Also assume for various reasons module A needs a private data store with static storage duration, accessible from files in more than one translation unit. ...
10
1480
by: John Swan | last post by:
Please, I have just created this site and am wondering what your opinion is from both professionals and amatures or the curious alike. Any opinions? www.integrated-dev-sol.co.uk Remove 123 from email address to reply. Anti spam and virus measure.
4
1181
by: Nemisis | last post by:
Hi everyone, I have 2 classes, Company and Contact, a company can have 1 or more contacts. A contact can only be in one company. I have created a Company class object that contains all the properties for my company. I have created a CompanyFactory class that has the methods to Create, Retrieve, Update and Delete a company. I have done the same for the Contact class and ContactFactory.
0
1045
by: felics60 | last post by:
What does one do if he wants to purchase a computer and he doesn't have the necessary informations in order to make a smart decision as to which item is best for him? Definitely, reviews from the experts are the best sources to obtain these details and are very helpful in forming opinions on products we don't know nothing about. The good thing about expert reviews is that it will inform us of the capabilities and limitations on the product...
11
1944
by: Neo Morpheous | last post by:
Ok, first lets start with some definitions: By "Expert", I mean someone who : 1). Is familiar with and understands the *MAJOR* concepts/philosopies underlying C# (and possible .Net as a whole - over and above CLI, CTS etc) 2). Knows which libraries to use for common and maybe not so common tasks 3). Can convincingly pass a C# technical interview (without having
0
9592
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10059
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9871
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8887
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5452
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3972
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3576
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.