Generating A Dll Of A Web Usercontrol?
Dec 8, 2010How can I make a dll of my web application usercontrol?
I have usercontrol222.ascx, but I want to make a dll out of this usercontrol.
How can I make a dll of my web application usercontrol?
I have usercontrol222.ascx, but I want to make a dll out of this usercontrol.
I've a ASP.Net page (Default.aspx) which will load UserControl (ucontrol.ascx) dynamically into an UpdatePanel. By using UpdatePanel, we believe we're able to prevent the entire page to be posted-back.
My problem is, within the UserControl, we have some form controls, such as inputs and buttons; after the UserControl is loaded, clicking on any button inside the UserControl will cause the UpdatePanel to be blanked. During the investigation, I found that, breakpoints within the Button1_Click() in the code-behind for the UserControl is never reached. Please reference to the code below, this references to [REFERENCE]1.
[code]....
This is page load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{ [code]...
But in my ascx.cs when IButton1_Click is trigered My name is null
private string _sname;
protected void Page_Load(object sender, EventArgs e)
{ [code]...
I have a page with an UpdatePanel with a UserControl in it. That UserControl contains a GridView with a nested UserControl that seems to disappear when the parent UserControl is rebound. I cannot for the life of me figure out why the child UserControl disappears. The code works beautifully on the first load, but any partial postback causes the "Pick" UserControl to disappear.
[Code]....
im creating site with usercontrols. I have repeater, inside it is another repeater with usercontrol. My problem is passing BindedValue to usercontrol.Bindings works fine and binds the value i need but it cannot pass the value to usercontrol. When i type it manually it works, when i bind it, it passes null (!).I've tried get,set, functions (ondatabound, onload, oninit), accessing control from code with no luck. Ive read and tried to do all the google solutions but with no luck. (even with creating usercontrol inheritance)
View 5 RepliesThere are 2 UserControls UC1 and UC2, and there is one more class C. I want to share the same instance of c in both UserControls. I know that this can be possible with properties in both UC's and by registering UC2 in UC1 or vice versa. But I want the solution to be loosely coupled. Any best possible way without touching the Actual Page (which hosts UC's)? So i need some best possible way between UCs transfering C.
View 5 RepliesI have MainLayout.master that has UC_Menu.ascx on it.
I have a page named Customer.aspx that uses MainLayout.master. Customer.aspx also contains a UserControl named UC_Details.ascx.
How can I have UC_Menu.ascx call a function that is in UC_Details.ascx with this scenario?
I've seen a few similar examples, but none that match this type of layout.
I have a UserControl, which contains another UserControl with Button. I want to add an event to that button in first UserControl (parent). I tried to do:
void Page_Init()
{
var btn = ChildControl.FindControl("SearchButton") as Button;
btn.Click += new EventHandler(this.SearchButton_Click);
}
but btn is null. How can I do that ?
I have 2 usercontrol in my .aspx page.
usercontorl1:
<asp:textbox id="txt" runat="server"></asp:textbox>
<asp:button id="btn" runat="server" text="send" />
usercontrol2:
Here I have gridview control with checkbox for selection of one or two records. Have one button and when clicking this , i need to get the selected records values and assign this values to the textbox which is in usercontrol1.
have a webpage that has a button and 2 userControl placed inside the placeHolder with visible set to false.When run and click on the button, userControl1 will set the visible to true. Now userControl1 is visible and there is also a button inside this userControl1 and when click, will set userControl2 visible to true and hide userControl1. The code below is the code behide for the webpage the do the above task.
[Code]....
Is there a way to do so that when click on the button inside userControl1, is does not show userControl2? I want to do this way is because, the button is for submitting data to database and then will pop up userControl2. When there is an error, only a msgBox will pop up and does not show userControl2.
I have two UserControls on a MasterPage. DataEntryUC contains several TextBoxes and DropDownList. NavSaveUC contains navigation buttons. When the user clicks on a navigation button, I will be saving the data entered into DataEntryUC from the NavSaveUC UserControl.
I have a couple of tables in my DB that contain stored procedure names, control names, control types, SqlDbTypes, etc.... that correlate with DataEntryUC.
How do I reference a text box that is on DataEntryUC from NavSaveUC?
I have been working on the following code from NavSaveUC with no luck.
Dim MyControlName = "txtFirstName"
Dim MyControlType = "TextBox"
Dim MyStringValue as String
Dim tmpTxtControl as TextBox
Dim tmpDdlControl as DropDownList
Select Case MyControlType
Case "TextBox"
tmpTxtControl = CType(Page.FindControl(MyControlName, TextBox)
MyStringValue = tmpTxtControl.Text
Case "DropDownList"
tmpDdlControl = CType(Page.FindControl(MyControlName, DropDownList)
MyStringValue = tmpDdlControl.SelectedValue
End Select
I have page having two user controls. Now I have a requirement for which i have to trigger one user control event from another user control.
View 1 RepliesI want to register an UserControl in another UserControl but i have some errors like :
Control '4_txtCount' of type 'NumbericTextBox' must be placed inside a form tag with runat=server.
Description: An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Control '4_txtCount' of type 'NumbericTextBox' must be placed inside a form tag with runat=server And when i add a server side from tag in my UserControl, i never get the error message.
How can i register and use an UserControl in another UserControl without adding server side form tag in UserControl?
I am trying to use the already written code which accesses a control from an other control in the following code.
Controls_SearchFeaturedMerchants UCMerchant = (Controls_SearchFeaturedMerchants)this.Parent.FindControl("UCSearchFeaturedMerchants1");
I am in need of generating a PDF document (or some other type of formatted document such as an rtf) on the fly from a weg page. I am aware of components such as PDFLIb, which I currently use on a few applications, however, quite expensive. Would anyone be able to suggest another method or component to do so? I need to have good formatting capability and additionally, not have the URL's display on the page generated, whne printed.
View 6 RepliesI am trying to generate a pdf document using the following code which i picked up from one of these forums. It had worked fine when I exported a gridview to pdf.
Now I need to export HTML code to pdf. Can someone suggest how to proceed, possibly using the gridview exporting code below? Any other approach is also welcome.
Code:
Response.ContentType = "application/pdf";
filename = "DocumentName.pdf";
Response.AddHeader("content-disposition", "attachment;filename=" + filename);
Response.Cache.SetCacheability(HttpCacheability.NoCache);
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
gridView1.RenderControl(hw);
StringReader sr = new StringReader(sw.ToString());
Document pdfDoc = new Document(PageSize.B2, 10f, 10f, 10f, 0f);
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
string sFinanceReportpath = ConfigurationManager.AppSettings["UploadFinanceReportPath"].ToString();
PdfWriter writer = PdfWriter.GetInstance(pdfDoc, new FileStream(sFinanceReportpath + filename, FileMode.Create));
pdfDoc.Open();
htmlparser.Parse(sr);
pdfDoc.Close();
//Response.Write(pdfDoc);
//Response.End();
I'm trying to redirect to another page by calling an action in controller with a specific parameter. I'm trying to use this line:
window.open('<%= Url.Action("Report", "Survey", new { id = ' + selectedRow + ' } ) %>');
But I couldn't make it work; it gives the following error:
CS1012: Too many characters in character literal.
Can't I generate the action URL this was on the client side? Or do I have to make an Ajax call by supplying the parameter and get back the needed URL? This doesn't seem right, but I want to if it's the only way.
I'm currently running a site of a dedicated server but want to scale up using Microsofts Azure cloud platform in the future but im unsure if a certin part of my code will work on azure.The site consists of a gallery of items with an image for each item.The images are stored in a sqlserver database.
I have created a http handler that caches the images to disk and redirects the request to the image (as shown at the end of the post).The images are saved into a virtual directory called "imagecache" inside my ASP.NET application. (i.e. ~/imagecache/ ).
As the web app will run in many virtual machine instances on the Azure platform the images will need to be shared between the instances right?So my question really is.. What is the best way of achieving what I already have on that is compatible wit azure?Image gen code..
public class getimage : IHttpHandler {
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public void ProcessRequest (HttpContext context) { [code]....
I have 3 tables(Status,Clist,longlead) having "WOnumber" common column in 3 tables and 3 web forms(status.aspx,Clist.aspx,longlead.aspx), on main page(status.aspx) i have buttons to redirect the clist.aspx and longlead.aspx to give the inputs and save it to database.I have button called scheduleReport on status.aspx when i click this button I want the values from Clist table and longlead table of corresponding WONumber values should be listed either in word or pdf.on the top of the report it should have WONUmber.
View 2 Repliesi have an application where users are allowed to fill in a form, once saved the form is given a unqiue # in this format: YYYY/MM/DD/### where ### is a 3 digit number, starts at 001, next one would be 002, etc.. the the YYYY/MM/DD is the date the form was saved, so if we had 2 saved today we would get these two:
2011/01/10/001
2011/01/10/002
I just wanted to know how to be sure that those numbers are always unqiue, if two people submit a form at the same time to make sure they are not given the same number? As we had that happen recently now that the application is being used a lot more, two people saved about the same time and once someone clicked save twice while the first save was happening and 2 of the same IDs were generated. Just want to make sure no matter what a unqiue one is always generated. I 'm able to calculate the ###, just wanted to know if there is a way to make sure it's not being used by a process saving right now.
In how many ways can an HTTP request be generated?
View 2 RepliesI'm trying to generate a bitmap off a WPF border. The whole thing sits in a asp.net app (server side of course) running .net 4.0. The problem is, that the generated image is, well, empty. Does anyone have an idea why? Here's the code.
public static byte[] Draw(int width, int height)
{
MemoryStream memoryStream
= new MemoryStream();
Thread t = new Thread(delegate()
{
System.Windows.Controls.Border border = new System.Windows.Controls.Border()
{
Background = Brushes.Red,
BorderBrush = Brushes.Green,
CornerRadius = new System.Windows.CornerRadius(5),
Width = width,
Height = height
};
border.ApplyTemplate();
RenderTargetBitmap renderTargetBitmap =
new RenderTargetBitmap(width, height, 90, 90, PixelFormats.Pbgra32);
renderTargetBitmap.Render(border);
BitmapEncoder bitmapEncoder =
new PngBitmapEncoder();
bitmapEncoder.Frames.Add(BitmapFrame.Create(renderTargetBitmap));
bitmapEncoder.Save(memoryStream);
});
t.SetApartmentState(ApartmentState.STA);
t.Start();
bool success = t.Join(5000);
if (success)
return memoryStream.ToArray();
else
throw new Exception("Fail");
}
The result is quite bad, as I said the thing returns the image with the right width and height, but it's empty, so I guess I don't mess the thing up with the threading bit.
I am in the process of adding an "add to outlook" button on a confirmation page received for user Training sessions signup on our website.
Here is a snippet of the code being used and below is the value returned for the DB
[Code]....
Value of the Description being returned:
"To access your scheduled training session, please call the following number below:
Step 1: Call into Toll Free phone number: 1-xxx-xxx-xxxx
Step 2: When prompted, enter PIN code xxxxxx followed by #
Step 3:From your web browser, login to the Web conference by visiting http://www.xxxxxxxx.com
If you should have any questions, please contact Kristin Osborn at 1-xxx-xxx-xxxx or email at someemail@somewhere.com. "
Now when the outlook appt generates. It only generates the first line of the description in the body
To access your scheduled training session, please call the following number below:
how to get it to generate the full string being returned by the SQL command?
I am currently watching the 80 minute ASP.NET MVC introduction. Automatically generating views from a model is pretty neat, but it seems to me that that the automatically generated views could be much better. For a start, instead of inputing dates with text boxes, there could be a date control. Additionally, number inputs could be verified client side. There are probably other improvements that could be made as well. Is it possible to automatically generate better views?
View 1 RepliesI know that this issue has been raised on so many occasion and I am stuck with two options, one being to create a thumbnail folder whenever a picture is uploaded to the server, here I am using a folder with so many subfolder, upon saving on the server folder, I pass in the subfolder name and the file name, to retrieve the image i need the two parameters but also the resize sizes and as such this measure is almost abosulte.
the other way is to resize on the fly when the user is requesting the picture, this is where I have been stuck on and need some guidance. and here is the code
[Code]....