.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Kaviya Balasubramanian
Imran Ghani
Post New Web Links

I cant use my created class in my web control

Posted By:      Posted Date: September 16, 2010    Points: 0   Category :ASP.Net
 
So this is the big picture:The picture should explained my situation. And I cant go to defination inside a class that call another class's method tooPls help me :(


View Complete Post


More Related Resource Links

Localization not working in class library (composite control)

  

Hi

I have a class library called WEM.portal which used Resource files to localise text in my composite controls.

I store my resource files (eg MyResourceFile1.resx) in App_GlobalResources folder and then refer to them using

MyLabel1.text = My.Resources.MyResourceFile1.MyResourceKey1

This is all working ok until I create seperate files for each language such as MyResourceFile1.FR-fr.resx.

I have implemented this throughout my other web applications but the Class Library doesnt seem to want to work the same way

When I load the page it correctly showes the resourced keys which I have done through the web application BUT the resource keys in the composite controls does not seem to pick up the culture code.

Am I missing something stupid. Ive tried

  • changing the Build Action on the resource file to Content and Custom tool to GlobalResourceProxyGenerator
  • Creating a resourceManager but to no avail



Snippet



Access a user created class in the form code

  
Hi Dear i have a litle problem i am developing a database application. In this app i write made two projects in the same solution. 1st named BussinessData and the 2nd one has a name Database Application. in business data i have add a libary class and made its region for easily code writing. now i want to get access at that class code from the application form code. example: sum of two numbers pubic class Sum #region "Public variables" dim a,b,c as integer #end region ' seperate region for getting values #region "Properites" public property a() as integer Get  return _a Set (by val value as sender)         _a=value end property #end region 'region for sum #region "Methods" public function sum() as integer c=a+b return c end function #end region in this way i have written the code and i want to get access this class from the form code. 'button_click code for the sum sum() plz help me to solve this problem  

how i can access a user created class in form code

  
Hi Dear i have a litle problem i am developing a database application. In this app i write made two projects in the same solution. 1st named BussinessData and the 2nd one has a name Database Application. in business data i have add a libary class and made its region for easily code writing. now i want to get access at that class code from the application form code. example: sum of two numbers pubic class Sum #region "Public variables" dim a,b,c as integer #end region ' seperate region for getting values #region "Properites" public property a() as integer Get  return _a Set (by val value as sender)         _a=value end property #end region 'region for sum #region "Methods" public function sum() as integer c=a+b return c end function #end region in this way i have written the code and i want to get access this class from the form code. 'button_click code for the sum sum() plz help me to solve this problem

Get content of programatically created control before postback

  
Hi.I have quite a problem here, and hope you can help :)I´ll try to describe the problem in steps, as this might be the easiest to understand:1. Page_Load is called when the page is requested, and calls a BuildTable() method2. The BuildTable method creates a table which contains several textboxes3. the user types some text in these textboxes4. The userthen  changes an item in a Dropdownlist on the page which is intended to change some other content on the page5. Page_Load is called, and afterwards the DropDownListBookingType_SelectedIndexChanged(object sender,EventArgs e) method are called, and the content is changed6. The text the user typed in the programmatically created textbox controls are lost!Now how do I remain this text information? If just the SelectedIndex_changed method was called first, I could save it in session.. But as far as I can tell, all data on the page are discarded when you create a partial postback :(What to do?Thanks alot for your time!

loadviestate of control created on the load() event

  
Why if I create a label on the load() event its properties are restored after a postback, even though it doesn't pass through the loadviestate stage? Example:Partial Class Default2 Inherits System.Web.UI.Page Protected Overrides Sub LoadViewState(ByVal savedState As Object) MyBase.LoadViewState(savedState) End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim lb As New Label Me.Controls.Add(lb) If Not Page.IsPostBack Then lb.Text = "xxxx" End If End Sub End Class <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>title</title> </head> <body> <form id="form1" runat="server"> <asp:Button ID="Button1" runat="server" Text="Button" /> </form> </body> </html>   And why everybody advice to create controls in the overrides of the method LoadViewState(), if it's ok also in the load() event

dynamically created button control click event not firing first time?

  
HI im creating a button control in page int and im assing a click event for the button control. here the click event is not firing for the first time.can anyone help me with this? here is my code. Button btn = new Button(); btn.ID = "btn"; btn.Click += new EventHandler(btn_Click); Panel1.Controls.Add(btn); Panel1.Controls.Add(new LiteralControl(""));

Find a form control that is created after postback

  
HiI have a drop down list (created during form design) with auto postback enabled. And I use AJAX to prevent 'visible postback'. When a user choose an item from the drop down list, the system will then perform a postback and created a set of form control's such as label, drop down list and text box for entry.Then, I will have a button (created during form design), and when I click on the button, i want to find for the form control that are created after the post back, but I cant find them!I wonder if those form controls are render to the web form?? But I have no problem finding the drop down list that is created during design time.Anyway I can find those form controls?Thank You.

Web User control in Class Library

  

Hello All,

 

I am trying to build a custom webpart in VS 2008 for MOSS 2007. I am using only class library for that.

How to add web user control in class library and add div tags in class library using C#.net?

 

Thanks!

 

 


Alignment for Dyanamically created control.

  

Hi,

I am creating some label and textbox dynamically in a Panel. I am not able to do alingment. I need to allign all textboxes. Below is code.

 private void LoadControls(string strGridId, DateTime dtGridDate)
        {
            pnlSectorGrid.Visible = true;
            DataSet ds = GetSectorialGridData(strGridId, dtGridDate);
            for (int Index = 0; Index < ds.Tables[0].Rows.Count - 1; Index++)
            {

                Label lblSectorName = new Label();
                lblSectorName.Text = ds.Tables[0].Rows[Index]["tsu_SubSectorName"].ToString();
                lblSectorName.Font.Size = 10;
                Label space = new Label();
                space.Text = "            "; 
                TextBox txtAlloc = new TextBox();
                txtAlloc.Text = ds.Tables[0].Rows[Index]["Alloc"].ToString();
                txtAlloc.Font.Size = 10;
                txtAlloc.Width = 90;              
                pnlSectorGrid.Controls.Add(lblSectorName);
                pnlSectorGrid.Controls.Add(space);
                pnlSectorGrid.Controls.Add(txtAlloc);             
                pnlSectorGrid.Controls.Add(new WebControl(HtmlTextWriterTag.Br));
                if (ds.Tables[0].Rows[Index]["tsu_SubSectorID"].ToS

I created a new control and im drawing some lines and points inside but the form1 designer throw me

  

This is the code of the control:

 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace My_Diet_Control
{
    public partial class My_Diet_Graph_Control : UserControl
    {
        int x_axis_lenght;
        int y_axis_lenght;
        int marginLeft;
        int marginRight;
        int marginBottom;
        int marginTop;
        My_Diet_Graph_Control myControl1;
        Diet_Data myData;
        public My_Diet_Graph_Control()
        {
            InitializeComponent();
        }

        private void My_Diet_Graph_Control_Load(object sender, EventArgs e)
      &nbs

How can I access a webform control from another external class/namespace?

  

Currently, I have many controls and objects such as Chart1 of mschart as part of the public partial class _Default : System.Web.UI.Page.


At the bottom, I've created a second class that is not part of the _Default webform class.  How can I access the webform controls from this second class?

For example, I want to do

Chart1.Series["Series1"].Points.AddXY((pointIndex + 1) * 40, datapoints[pointIndex]);

I want to pass pointIndex integer and the datapoints array.

I know that Chart1 was created protected global access modifier in the designer.cs but when I changed it to public, it still had a problem.


Thanks


How to use Login Control in already created Web Site Project ?

  

Hi,

actually i have already created my web site project.Now i want to use login control in my project.So can you please guide me how i can use it in my existing project? 


control not working when created on new thread

  

Hi,

I recently read this article and implemented -

http://blogs.msdn.com/dwayneneed/archive/2007/04/26/multithreaded-ui-hostvisual.aspx

I changed my control (dev express pivot grid) to be created on a secondary background.

The control is loading and displaying faster (great) but now if I try t omove the scrollbar etc nothing happens. The control has stopped responding to events.

Can anyone tell me how to resolve this issue. I'm not exactly sure where to start looking.

I need a way of getting the mouse drag events across to my control on the secondary thread.

Thanks.


C# following exception while reflection of dynamically created control.

  

ControlType = "System.Windows.Forms.WindowsFormsApplication1." + "PictureBox1"; System.Reflection.Assembly asm; asm = typeof(Form).Assembly; ControlObject = (System.Windows.Forms.Control)asm.CreateInstance(ControlType); ControlObject.Name = ControlName; The next code generated following exception for me: ControlObject.Name = ControlName;

NullReferenceException was unhandled Object reference not set to an instance of an object.


How to reference an UI control from my ModelView class?

  

I have a listview which contains checkbox items

 <ListView x:Name="listControl"
               SelectionMode="Multiple"
               ItemsSource="{Binding Userlist}"
               ItemTemplate="{StaticResource ItemDataTemplate}" 
               CheckBox.Unchecked="OnUncheckItem" />

I need to know how to reference "listContro

Component with name "sql server destination" and class ID {} could not be created because it was bui

  

Hi using VS2005 with sql2005 I get the above error message for all my package sql server destination objects. I also have vs2008 installed on my machine and am wondering whether this is causing this error. Either way, any idea for a solution?

Using the connection manager I have set up an ole db/sql connection that tests successfully.

Many thanks,


Jonathan

Find URL/URI/Domain in server control and class library

  

hi Smile

I was develop a DLL file for our website
this DLL is main application in our website.

I want to make it for work on one website

like www.example.com

when copy to another website like www.ooutttgbhjj.com not work

How can i to do this?

Thank you :)


Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend