|
Hello there,
Thanks for the example...i tried to use the read only property as you mentioned above and accessed the text box from the page's code behind in this way TextBox textBx = pumpassembly.installationDateTextBox;
technically it should have the text box control in the textBx variable when I step through this code, but it returns NULL just as it was before when I was using FindControl approach????
By the way, just an FYI, I'm loading these user controls in the pre_render event...so they don't get loaded in the page load...anyways, but the code TextBox textBx = pumpassembly.installationDateTextBox; is being executed from a button called ADD on the page (Add buttons click event handler). The reason I'm mentioning this is because all of a sudden it occurred to me that what if the user control (whose text box we are trying to access) is not loaded at the time, but that's not true because the page has already been loaded at this time once and that's when user clicks the Add button. I'm sooooo confused
Also sorry i must have misunderstood, here is the ascx code you asked for.
<div style="margin-bottom: inherit; bottom:inherit; margin-top: inherit; position: relative; display: block;<br mode=" hold=" /> float: left; border-style:None; width: 600px; height:300px">
<div style="position: relative; float: left;">
<asp:label id="pumpAssemblyLabel" runat="server" font-bold="true" text="General Information" xmlns:asp="#unknown"></asp:label> </div>
<asp:label id="_installationDateLabel" runat="server" text="Installation Date" xmlns:asp="#unknown"></asp:label>
<asp:textbox id="_installationDateTextBox" runat="server" width="91px" xmlns:asp="#unknown"></asp:textbox>
<asp:label id="_manufacturerLabel" runat="server" text="Manufacturer" xmlns:asp="#unknown"></asp:label>
<asp:dropdownlist id="_manufacturerDropdown" runat="server" appenddatabounditems="True" xmlns:asp="#unknown">
DataSourceID="Manufacturerds" DataTextField="ManufacturerName" DataValueField="ManufacturerID">
<asp:listitem>---Select One---</asp:listitem>
</asp:dropdownlist>
<asp:objectdatasource id="Manufacturerds" runat="server" typename="DataAccessLayer.ManufacturerDataSource" xmlns:asp="#unknown">
SelectMethod="GetManufacturerUsingDB"></asp:objectdatasource>
<br />
<asp:label id="_modellabel" runat="server" text="Model" xmlns:asp="#unknown"></asp:label>
<asp:textbox id="_modelTextbox" runat="server" width="111px" xmlns:asp="#unknown"></asp:textbox>
<asp:label id="_serialNumLabel" runat="server" text="Serial Number" xmlns:asp="#unknown"></asp:label>
<asp:textbox id="_serialNumTextBox" runat="Server" width="113px" xmlns:asp="#unknown"></asp:textbox>
<br /></div>
Thanks
Tina
|
|
|
|
|
Tina P wrote: I'm loading these user controls in the pre_render event...so they don't get loaded in the page load
What do you mean by this??
Prerender is of the last events in the page, after handling any licks, selectedindexchanged and so on
Anyways, i dont know what might be causing the problem, i made a really basic example
UserControl:
.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs" Inherits="Test_WebUserControl" %>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br />
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
Page:
.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.aspx.cs" Inherits="Test_WebUserControl" %>
<%@ Register Src="WebUserControl.ascx" TagName="WebUserControl" TagPrefix="uc1" %>
<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<uc1:WebUserControl ID="WebUserControl1" runat="server" />
</div>
</form>
</body>
</html>
.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Test_WebUserControl : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
TextBox txt = this.WebUserControl1.FindControl("TextBox1") as TextBox;
txt.Text = "Something";
}
protected void Page_Prerender(object sebder, EventArgs e)
{
//TextBox txt = this.WebUserControl1.FindControl("TextBox1") as TextBox;
//txt.Text = "Something";
}
}
I tryed setting the text property in the prerender and it also worked
Alexei Rodriguez
|
|
|
|
|
hey guys, I have a drop down list which is supposed to show a combination of two dates (lets say insert date and pull date) separated by a underscore or something. The problem is that I only want the date to be shown and not the time (it's putting in a default time 12 AM in there) Now I could call ToShortDateString on the date that is being returned if I only had a single date coming back but since I'm getting a SQLDataReader object back, I can't even call that on it.
here is the code that I'm using:
public static SqlDataReader getDatesByWellId(Int32 wellId)
{
string dsn = System.Configuration.ConfigurationManager.ConnectionStrings["AMasterConnectionString1"].ConnectionString;
SqlConnection conn = new SqlConnection(dsn);
String query = "Select Convert(Varchar,InstallDate)+' '+Convert(Varchar,PullDate) As DateInfo From tblAssemblyMaster With (NoLock) Where WellId=" + wellId + " " + "Order By InstallDate Asc";
SqlCommand cmd = new SqlCommand(query, conn);
conn.Open();
SqlDataReader sdr = cmd.ExecuteReader();
return sdr;
}
Is there anything that I can do to fix this? Like I said earlier all I wanna display is a date range for instance something like this: 4/11/2007 - 6/19/2008. Can someone shed some light on this!
Thanks
Tina
|
|
|
|
|
Select Convert(Varchar,InstallDate,105)+' - '+Convert(Varchar,PullDate,105) As DateInfo ...etc
|
|
|
|
|
Thanks for your help, I just started working with .Net and didn't even know about those formatting values. I appreciate your help!
Tina
|
|
|
|
|
Dear All,
I am using C# , Asp.net2.0
I am using server.tranfer to redirect the another webpage with parameter
I have root folder and my aspx file is inside another folder in root that is root -> folder -> test.aspx
Now I am using following code redirect as
Server.Transfer("/Demo/FrmChecklist.aspx", true);
But I am getting error as path not mapping
Please suggest
imran khan
|
|
|
|
|
Try
Server.Transfer("~/Demo/FrmChecklist.aspx", true);
|
|
|
|
|
Hi,
I have a checkboxlist which i pull the options from a database on the page and I have got it submitting multiple checked values into the database, but im having problems creating the page to display which values have been checked. Could someone please help?
The look up table is:
Table - refCommittee
CommitteId - int
CommitteeName - varchar
Active - bit
The table holding inserted values
Table - tblApprovingCommGroup
ID - int
PolicyID - int
CommitteID - int
Many thanks
|
|
|
|
|
i want to display the file name not whole path in asp.net C#.
I use datalist and in datalist i have taken link button to show the file name. my path storedin database.
thanks
|
|
|
|
|
You're not having much luck with this, are you?
to extract filename.ext out of str = "drive/folder/path/filename.ext" try
str.SubString(str.LastIndexOf("/") + 1)
|
|
|
|
|
He's already been told the right way numerous times
string str = "drive/folder/path/filename.ext";
string filename = Path.GetFilename(str);
|
|
|
|
|
J4amieC wrote: string filename = Path.GetFilename(str);
Yes, that works too! Do you know, I never thought ot try that on a simple string - just assumed the argument needed to have been defined through a file object (or HttpPostedFile or something)... how embarrassing
|
|
|
|
|
Hi All
I am using Replace in Old ASP
and its not working
I am using
Replace cont,"my_documents/","master/my_documents/"
and It not replace the text
any body have solution
Amit Battan Ror
battan20@gmail.com
|
|
|
|
|
Probably because you haven't take case-sensitivity into account
clickety[^]
|
|
|
|
|
hi i am using file up loader to store path of the file in database and value show in datagrid in linkbutton text i want when i click on this link file should be open. if file is .rar or .zip than open save dilouge box .
I will do my best?
Integrated Solutions, Bikaner (Raj.), India
|
|
|
|
|
Are you facing any issues in this? What's your requirement?
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
Can anybody please tell me how to change the page extension in asp.net
e.g. default.aspx to default.abc
|
|
|
|
|
Are you mentioning about url rewriting? If so, please check with this url:
URL Rewriter
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
It is done using URL Rewriting. Doing a search for "URL Rewriting ASP.NET" will give you plenty of articles.
|
|
|
|
|
You can do it using url rewriting or by registering the extension in IIS.
For url rewriting of extensions that are not handled by ASP.NET, you need to install an ISAPI dll like IIS Mod-Rewrite (unless you are running Server 2008).
To register the extension for ASP.NET you just add another extension for the web application in the IIS Manager, with the same settings as the aspx extension.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
How to read PDF file using C# Can any one help from solving my problem i am thankfull.
jagadish
|
|
|
|
|
jagadish reddy wrote: Hi Friends
Consider putting a meaningful title for your post.
jagadish reddy wrote: How to read PDF file using C#
I don't think that you can read PDF file. Why do you need to do this?
|
|
|
|
|
N a v a n e e t h wrote: I don't think that you can read PDF file
Wrong. just google it and see the thousands of results.
|
|
|
|
|
hi all
i need a usercontrol of autocomplete textbox.
the data of that autocomplete textbox comes from sql server table.
cud anyone give suggestions on it that how to do this.
Er. Jagwinder Singh
|
|
|
|
|
Use AJAX and show your results in a DIV. You have to get new results when user types in the textbox. Handle OnKeyPress event and send AJAX calls to the server.
|
|
|
|