|
It's not a good idea to expose controls by making them public. The client program will be able to change the value or even worse, clear the dropdown by calling myUserControl.myDropDownList.Items.Clear() which is not what you want. See my answer for a better solution.
"Don't confuse experts with facts" - Eric_V
|
|
|
|
|
Well, some times this might be required.
I totally agree, when not required, we can simply expose the portion which is required to be accessed.
But when we need, we can expose the DropDownList also. I had such requirement in my earlier project where we had to set the listItem values from Page.
|
|
|
|
|
Anurag Gandhi wrote: Well, some times this might be required.
There is not a single situation where it is required, you can always forward calls to your internal controls through properties and methods in the user control. Take your example, you could have created methods/properties that set the list item of your dropdown.
"Don't confuse experts with facts" - Eric_V
|
|
|
|
|
In your user control, create properties that expose the information you want. Like this:
public string SelectedValue {
get {
return dropdown1.SelectedValue;
}
}
And then from the clients, you can access the property like this:
string selValue = userControl1.SelectedValue;
"Don't confuse experts with facts" - Eric_V
|
|
|
|
|
Good Morning All
i have an asp.net hosted in IIS. that uses the Com library "Microsoft Word 14.0 Object Library". I am using this to convert the word Document to PDF, on my machine it works. I have Office 2010 on my machine and on the server we have installed Office 2011 too. but when i try to run my app on the server it gives me the Following error
Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
i have given all the permissions to the aspnet user and other users full access but this does not work ,
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@dotnetfunda.com
http://www.Dotnetfunda.com
|
|
|
|
|
Vuyiswa Maseko wrote: I have Office 2010 on my machine and on the server we have installed Office 2011 too.
Did you mean you've install Office 2010 on the server?
"Don't confuse experts with facts" - Eric_V
|
|
|
|
|
Yes
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@dotnetfunda.com
http://www.Dotnetfunda.com
|
|
|
|
|
Have you tryed to add Local Computer\NETWORKSERVICE user rights to directory. Also make sure the directory resides on the same machine that the iis is located.
I had this issue before and this worked.
RB ![Blush | :O](https://www.codeproject.com/script/Forums/Images/smiley_redface.gif)
|
|
|
|
|
How to change the position of an applet on an asp.net page without reloading the applet? I tried to do it with the help of css but the applet starts its (startup) operation after the css style class has been changed.
I have a signed java applet. It gets some data from a client PC then a user clicks on a button inside the applet and it must trigger some changes to the web page.
For now after the button inside the applet was clicked the applet puts a new url to the parent window that is the same url but with a parameter "?results".
The problem is that even if if will find a way to pass data from applet to the web page with out the usage of url, the applet still reloadsd, for instance if I just change the class of style of the applet to change its position on the web page.
Maybe it is possible to store the data from the applet (hashmap) in RAM and then the applet would check if that data exists when it (or the whole page) reloads?
Thanks.
|
|
|
|
|
Can I have multiple .aspx files with their own code-behinds?
I have two aspx pages and one works fine, but the other does recognize any of the asp controls in the code-behind. Here's what I got:
One asp page with the code directive:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="page1.aspx.vb" Inherits="_class1" SmartNavigation="true" Debug="true" %>
My other page has the code directive:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="page2.aspx.vb" Inherits="_class2" SmartNavigation="true" Debug="true" %>
I then have 2 code-behind files:
One labeled page1.aspx.vb with:
Partial Public Class _class1
Inherits System.Web.UI.Page
One labeled page2.aspx.vb with:
Partial Public Class _class2
Inherits System.Web.UI.Page
|
|
|
|
|
Try opening the page in design mode. Sometimes that will regenerate the designer file. If that doesn't work then delete the *.designer.cs (or *.designer.vb for those developmentally challenged) and reopen the file in design mode to regenerate the file.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
ID col1 col2 col3 col4 rescol
121 0 1 2 6 YES
122 0 1 2 6 YES
123 0 0 9 0 NULL
Above are the Sql rows and if my function finds null for the ID=123 as 9 of col3 then i need to locate for before id's rescol and if that also find as null then i need to fetch for the above row of 121, like this till i am not getting res col as null i need to fix a loop how can i do this?
In try catch block i am handling the above mentioned functionality as if i get error my catch block will call its above row's rescol value. but how many catch block i will put here because the rows are dynamic and unknown how many catch i will get executed.
|
|
|
|
|
If I understand your question correctly, you can try something like this:
SELECT TOP 1 rescol
FROM Table1
WHERE rescol IS NOT NULL
AND col3 = 9
AND [ID] BETWEEN 100 AND 200
ORDER BY [ID] DESC
And remember that try catch is only for handling exceptions, it is a very worst programming practice to use it for implementing logic within your application.
|
|
|
|
|
i answred some of questions posted other members in code project. my answer was best of my knowledge . but my answer is down voted.i felt like insulting me
|
|
|
|
|
This is the wrong forum. Other member has already said to post in Site-Bugs-Suggestions[^] forum when asked in QA section. So its better to post it there you will get better replies.
|
|
|
|
|
It's the way this site works; there are people around who will downvote you at the drop of a hat. Learn to live with it. Note that you got downvoted here for posting this question in the wrong place.
|
|
|
|
|
Wow. A triple post. I would suggest you need to learn about how things work here. Read the FAQs and gain some insight into why you are being downvoted. There is no intent by anyone to "insult" you. The people downvoting you do not know you, they are simply critiquing your answers based on the content and the forum rules. I would suggest you take the advice provided.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
hi
How to Preview Image Before Upload in the asp.net
thanks
|
|
|
|
|
Upload the image to the server asynchronously using Ajax, and then, show it dynamically as a preview.
|
|
|
|
|
I am working on trying to load some control code that is saved in a text file. The code is constructed of ASP.Net controls but could consist of any type of control from PlaceHolder, LliteralControl, TextBox, etc. How can I load this into a control located on the page?
for example, I could pull this from a file or database.
<asp:textbox runat="server" id="textbox1">
<asp:label runat="server" id="label1">
Control c = new Control();
//How to get raw text to control and add control to page???
c.????
Page.Controls.Add(c);
|
|
|
|
|
Found it.
c.ParseControl()
|
|
|
|
|
Hi,
I have a repeater in my aspx page. The datasource for this will change for different types of call hence I cannot do
<ItemTemplate>
<tr >
<td bgcolor="" valign="top">
<%#DataBinder.Eval(Container.DataItem, "Id")%>
</td>
...
</tr>
</ItemTemplate>
as the dataItem will be different. Which is the best way to do it server side?
Thanks,
|
|
|
|
|
If you want to use DataBinding like this you would need to convert each datasource to use the same columns, with the same names. Not a bad thing. If the datasources will all have different columns with different types you may want to use a DataGrid and set AutoGenerateColumns=true;
Otherwise, you will need to manually add ITemplates to your repeater based on the selected datasource
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
yes I had set the autogenerate columns as true and it works fine.
Issue is I also had a jquery to select the selected row value and it ended up having lots of magic numbers for the colums in different states. Very difficult to understand and maintain. I want to access dataItem value on row click and hence trying to map dynamically .
Thanks,
|
|
|
|
|
How can I get server side validators to work with JQuery UI Modal with validation groups ? ![Frown | :(](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_frown.gif)
|
|
|
|