|
Hello All,
I have created a custom web control. This control contains three different textboxes. I place this control on web form. There is a button on web form. When I click on button, I need to access values of those textboxes. I appreciate if anyone can tell me how to access that value.
Appreciate your help.
Here is the code for Control.
public class MyControl : WebControl
{
private TextBox textbox1 = new TextBox();
private TextBox textbox2 = new TextBox();
private TextBox textbox3 = new TextBox();
[Category("Appearance")]
[DefaultValue("")]
[Localizable(true)]
[Description("This returns value of textboxes as string")]
public string TextBoxChars
{
get
{
this.EnsureChildControls();
return this.textbox1.Text + "-" + this.textbox2.Text + "-" + this.textbox3.Text;
}
}
protected override void Render(HtmlTextWriter output)
{
this.EnsureChildControls();
base.Render(output);
}
protected override void CreateChildControls()
{
this.Controls.Clear();
this.Controls.Add(new LiteralControl(
"<table width='100%' height='100%' " +
"cellpadding='3' cellspacing='3'>"));
this.Controls.Add(new LiteralControl("<tr><td width='100%'>"));
this.Controls.Add(textbox1);
this.Controls.Add(new LiteralControl("</td></tr>"));
this.Controls.Add(new LiteralControl("<tr><td width='100%'>"));
this.Controls.Add(textbox2);
this.Controls.Add(new LiteralControl("</td></tr>"));
this.Controls.Add(new LiteralControl("<tr><td width='100%'>"));
this.Controls.Add(textbox3);
this.Controls.Add(new LiteralControl("</td></tr>"));
this.Controls.Add(new LiteralControl("</Table>"));
}
}
- ashish
|
|
|
|
|
I just have to inherit control from INamingContainer
regards,
- ashish
|
|
|
|
|
OnInit()
{
...
this.textbox1.Text = Request.Form[textbox1.UniqueID].ToString();
...
}
or
bool IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection)
{
bool dataChanged = false;
if (postDataKey == this.UniqueID)
{
textbox1.Text = postCollection[textbox1.UniqueID];
Dan Satria
Principal Consultant
Graha Logica, Inc.
|
|
|
|
|
Hi
We have a webapp which the users pull large amounts of data from a remote system. The first user gets hit with the delay as this data is pulled back. It is then caches using Application[dataname] = thisdata. Subsequent requests pull the data from the cache and everybody is happy, and the first user calms down halfway through the morning!
We have had a trace on the data pulled back, and every morning, the same three sets of data are always requested. Is there anyway we can 'pre fill' the Application[] cache with these datasets before anybody hits the app? That's datasets in a loose sense of the term - not real ADO datasets. Sets of data is more correct.
Regards
Angel
*********************************************
The sooner you fall behind, the longer you have to catch up.
|
|
|
|
|
Hi Angel,
IMO, you should use the Cache object instead of the Application to cache data as it provides you with a couple of ways to specify when you need to refresh the cached data based on the expiration policies or the dependencies. You can read more about this in MSDN:
ASP.NET Caching Overview[^][^]
|
|
|
|
|
Hi all,
My query returns 2 records in single variables I need to get the values in DataReader.
Ex: My query is :
SELECT schauditor_employee
FROM scheduleauditor , schedule
WHERE schedule_no = 1
AND schauditor_schedule = schedule_no
It returns two number say 4 and 5.I need to store it in some variable or say class property so that I can check these values on my form(Code Behind).
Please help.....Its Urgent...Thanks in advance.
|
|
|
|
|
here u got this example
SELECT table1.*,table2.* <br />
FROM table1, table2<br />
WHERE table1.column = value<br />
AND table1.id = table2.id
|
|
|
|
|
No thats not my problem.Actually When query is executes it returns 2 records say 4 and 5.Now I need to store this records.How do I do this???
|
|
|
|
|
What have you tried? Post your query code and I will have a look and see what is missing or needed.
Regards
Angel
*********************************************
The sooner you fall behind, the longer you have to catch up.
|
|
|
|
|
I have already posted my code can u please read my first posted message..
Thanks and Regards.
|
|
|
|
|
You posted an SQL statement.
Show me what your client code looks like which executes this. You must have a web page that sends this query to the database. Show me what code you have already written to attempt to get this to work.
Regards
Angel
*********************************************
The sooner you fall behind, the longer you have to catch up.
|
|
|
|
|
SqlConnection c = new SqlConnection(
c.Open();<br />
DataSet ds = new DataSet();<br />
string sel = " SELECT schauditor_employee "+<br />
" FROM scheduleauditor , schedule "+<br />
" WHERE schedule_no = 1 "+<br />
" AND schauditor_schedule = schedule_no ";<br />
SqlDataAdapter da = new SqlDataAdapter(sel,c);<br />
da.Fill(ds);<br />
string value1 = ds.tables[0].Rows[0][
string value2 = ds.tables[0].Rows[1][
c.Close();
|
|
|
|
|
What if the query returns only one record???
|
|
|
|
|
check the ds.tables[0].Rows.length variable which will tell you how many rows are int he table your querying. Or it may be ds.tables[0].Rows.count - can't remember.
Have you actually done any google searches for this?
Regards
Angel
*********************************************
The sooner you fall behind, the longer you have to catch up.
|
|
|
|
|
if dataset return different number of rows and want to get all values of rows then create number string variables equal with number of rows and set each strinng variables value from returned rows.
|
|
|
|
|
Can't I use arraylist.
Thanks and Regards.
-- modified at 9:00 Wednesday 21st June, 2006
|
|
|
|
|
Hi,
look it may help you.
''''''''''''''''''''''''''''''First Create one class
Public Class ComboClass
Private _id As Integer
Public Property ID() As Integer
Get
Return _id
End Get
Set(ByVal Value As Integer)
_id = Value
End Set
End Property
Private _name As String
Public Property Name() As String
Get
Return _name
End Get
Set(ByVal Value As String)
_name = Value
End Set
End Property
End Class
public sub Save()
//some database code here
Dim dataReader As IDataReader = database.ExecuteReader(dbCommandWrapper)
Dim comboClass As ComboClass
Dim returnArrayList As New ArrayList
While (dataReader.Read())
comboClass = New ComboClass
With comboClass
.ID = Convert.ToInt32(dataReader(0))
'TODO take this hack oout and replace with a column name
.Name = Convert.ToString(dataReader(1))
End With
returnArrayList.Add(comboClass)
End While
end sub
After this you have Arraylist with all fetched values that you can use.
Regards,
Nagraj
Let's Teach Life To Laugh........
|
|
|
|
|
I have this javascript:
function ConfirmationWindow()
{
var result = confirm("Are you sure");
}
This pops up a window for confirmation. Based on a yes or no selection by the user, I will like to insert or delect some data from a database but my problem is that, how do I get the true/false value of "result" which is in javascript and use it in my C#?
Any suggestion will be great
Thanks alot,
Commickey
|
|
|
|
|
U can take one Hidden textbox of html and store true or false depending on the selection of Yes or No by the User.
Brfore saving the record u first check the value of the hidden textbox and the save it.
I hope u got what I want to say.
Thanks and Regards.
|
|
|
|
|
sorry, can u help me with a code on how to do this?
|
|
|
|
|
Hi,
Just Drag and drop html hidden textbox on ur wen form and write the following javascript code and the changes accordingly...
function CommitChanges()
{
document.all("<%=htxtSName.ClientID%>").value = document.all("txtShortName").value;
document.all("<%=htxtLogName.ClientID%>").value = document.all("txtLogin").value;
var text = "Do you want to save the changes?";
if(!confirm(text))
{
document.all("<%=htxtSave.ClientID%>").value = false;
return true;
}
else
{
document.all("<%=htxtSave.ClientID%>").value = true;
return true;
}
Use this code for ur reference.htxtSave is the hidden textbox.
Thanks and Regards.
|
|
|
|
|
Another approach would be to have a button on the form that isn't displayed, which calls the update routine on the server - the check would then be something like....
<br />
res = confirm('do something?');<br />
if (res)<br />
{<br />
document.getElementById('MyASPNETButton').click();<br />
}<br />
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
WHATS WORNG WITH THE CODE BELOW---
<%Dim objCDONTS ' Email object
Set objCDONTS = Server.CreateObject("CDONTS.NewMail")
objCDONTS.MailFormat = 0
objCDONTS.BodyFormat=0
objCDONTS.From = "Admin" & " <" & "admin_auto@" & Request.ServerVariables("HTTP_HOST") & ">"
objCDONTS.To = Trim(Request.Form("mfr"))
objCDONTS.Subject = "Acknowledgement[Report a Problem]"
strBody ="We are dealing with your problem.This message is a system generated acknowledgement to your report. Please do not reply to this."
objCDONTS.Body = "--------------------------------------" & vbcrlf & vbcrlf & strbody & vbcrlf & vbcrlf & " --Support Team : Http://"& Request.ServerVariables("HTTP_HOST") & vbcrlf & "--------------------------------------------------------------" & vbcrlf & "MESSAGE ENDS: End of message"
objCDONTS.Send
Set objCDONTS = Nothing
response.write "mail sent to :"+Trim(Request.Form("mfr"))%>
MY WEBSERVER SUPPORT CDONTS MAIL
HELP ME ..PLZE
SREE
|
|
|
|
|
|
its notatall sending message. thats the problem is........
|
|
|
|