|
hii
sorry for let reply..
try this...
str2 = " Select * from Bithdays WHERE (DATEPART(month, BirthDate)) ='" & Date.Today.Day &"' And (DATEPART(day, BirthDate) = '" & Date.Today.Month & "'"
Jintal Patel
|
|
|
|
|
Your solution has been morethan helpful.Now I can see the light, but the little problem I now encounter is that "No value given for one or more required parameters.".It was showing month as 14 which is today's day and 11 as the day which is the month.But after sorting the missing ")".
I get this message on the
GridView1.DataSource = cm.ExecuteReader(CommandBehavior.CloseConnection)
GridView1.DataBind().
I checked the values how they correspond with the string, its fine and the date formate(yyyy/mm/dd) is fine.What cud be the problem now.
kagiso
|
|
|
|
|
please send me the total code or that function so i can understand your problem perfactly...
Jintal Patel
|
|
|
|
|
Imports System.Data
Imports System.Web.UI.Control
Imports System.Web.UI.WebControls.WebControl
Imports System.Web.UI.WebControls.LinkButton
Imports System.Data.oledb
Imports Microsoft.VisualBasic.ApplicationServices
Imports Microsoft.VisualBasic.OpenShare
Partial Class Birthdays
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim comx As New OleDbCommand
Dim conx As New OleDbConnection
Dim con As New OleDbConnection
Dim str1 As String = "Provider = Microsoft.Jet.oledb.4.0; Data source =C:\Documents and Settings\kagisho.mashiloane\My Documents\Visual Studio 2005\Projects\Search AL\TelephoneList.mdb"
Dim cm As OleDbCommand
Dim str2 As String
con = New OleDbConnection(str1)
con.Open()
str2 = " Select * from Bithdays WHERE (DATEPART(Month, BirthDate)) ='" & Date.Today.Month & "' And (DATEPART(Day, BirthDate)) = '" & Date.Today.Day & "'"
cm = New OleDbCommand(str2, con)
GridView1.DataSource = cm.ExecuteReader(CommandBehavior.CloseConnection)
GridView1.DataBind()
If con.State = ConnectionState.Open Then
con.Close()
End If
con.Open()
End Sub
Again, thank you very much for ur time and effort
kagiso
|
|
|
|
|
hiii
this will definately work just change ur str2 to belove
str2 = "select * from Birthday WHERE (DATEPART('m', BDate)) = '" & Date.Today.Month & "' And (DATEPART('d', BDate)) = '" & Date.Today.Day & "'"
cm = New OleDbCommand(str2, con)
GridView1.DataSource = cm.ExecuteReader(CommandBehavior.CloseConnection)
GridView1.DataBind()
Jintal Patel
|
|
|
|
|
You have no idea how much this means to me.It works like a charm.
I wud buy you lunch, but ur there.Thanx a million.
Damn, thank you very much.
kagiso
|
|
|
|
|
|
matjame wrote: the problem is that the values I have to give it are system generated(i.e the day and month I get from the database are compared to the day and month from my machine) so I cant use that method.
Yes, you can. The @mt and @dt values are parameters. Add two parameter objects to the command object, with the values for the month and day.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
How can i call a javascript function from a Contentplaceholder?
can we get document object from here?
Thanks and Regards
Yesuprakash
|
|
|
|
|
ypki wrote: Contentplaceholder?
can we get document object from here?
Javascript don't understand Master pages/Content pages. All these will be rendered together to produce page. So you can write it anywhere.
|
|
|
|
|
but i cant get the control in content.
I try document.formname.textbox1 and document.getelementbyid("textbox1")
both showing unidentify in javascript
I am trying to use calenser control
|
|
|
|
|
ypki wrote: I try document.formname.textbox1 and document.getelementbyid("textbox1")
document.getElementById(<% textbox1.ClientId > )
|
|
|
|
|
Hi,
after running your application page,see page source. In that you will see that your control named textbox1 is chaged to "ctl00_contextplaceholderName_textbox1". so see that new ID and then get from javascript.
Thanks,
Sun Rays
|
|
|
|
|
hi...
i am having a contentpage which has many textboxes.Pls let me know the code(in c#)to clear textboxes at a button click.
SunithaNallana
|
|
|
|
|
SunithaNallana wrote: to clear textboxes at a button click.
Clearing textbox value ?
|
|
|
|
|
yes to clear textboxes values
SunithaNallana
|
|
|
|
|
Content place holder will have Control collection property. Iterate through each item and check if it is TextBox. If yes clear the text.
|
|
|
|
|
thank u all
i cleared my doubt.
i have done it this way...
1.in the master page i put a property block in which i wrote
public ContentPlaceHolder CPH
{
get{return ContentPlaceHolderid;}
}
2.i made the content page strongly typed ie..
<mastertype virtualpath="masterpagefile path">
3.in button click function
foreach(control c in Master.CPH.Controls)
{
if(c.getType().Name == "TextBox")
{
(c as TextBox).Text ="";
}
}
SunithaNallana
|
|
|
|
|
Not a good way of doing but you can try
ArrayList al = new ArrayList();
foreach(Control c in Page.Form.Controls)
{
if(c.GetType() == typeof(TextBox))
{
al.Add(c);
}
}
foreach(TextBox t in al)
{
t.Text = "";
}
But There should be any other better way to do it.
here I have assumed that you have all the textboxes in same form. In case its not true You will have to loop through all the forms.
Happy Birthday!!!
|
|
|
|
|
Prateek G wrote: ArrayList al = new ArrayList();
foreach(Control c in Page.Form.Controls)
{
if(c.GetType() == typeof(TextBox))
{
al.Add(c);
}
}
foreach(TextBox t in al)
{
t.Text = "";
}
No need to loop 2 Times.
foreach(Control c in Page.Form.Controls)
{
if(c.GetType() == typeof(TextBox))
{
Textbox t = (Textbox)c;
t.Text = "";
}
}
Thanks,
Sun Rays
|
|
|
|
|
Prateek G wrote: foreach(Control c in Page.Form.Controls)
This will clear all textbox controls in page. I think question is how to clear the textbox in content place holder.
|
|
|
|
|
thank u all
i cleared my doubt.
i have done it this way...
1.in the master page i put a property block in which i wrote
public ContentPlaceHolder CPH
{
get{return ContentPlaceHolderid;}
}
2.i made the content page strongly typed ie..
<mastertype virtualpath="masterpagefile path">
3.in button click function
foreach(control c in Master.CPH.Controls)
{
if(c.getType().Name == "TextBox")
{
(c as TextBox).Text ="";
}
}
SunithaNallana
|
|
|
|
|
thank u Prateek.G
for wishing me on my birthday.
SunithaNallana
|
|
|
|
|
Try this and call this function on the server side.
< script >
function Clear()
{
obj=document.getElementsByTagName("INPUT");
for(i=0;i< obj.length;i++)
{
if ((obj[i].type == "text"))
{
obj[i].value = "";
}
}
< /script >
Let me know whether you got the solution.
God is always with you.
|
|
|
|
|
Saranya Devi wrote: function Clear()
{
obj=document.getElementsByTagName("INPUT");
for(i=0;i< obj.length;i++)
{
if ((obj[i].type == "text"))
{
obj[i].value = "";
}
}
This will clear all textboxes, not in the controls in content page
|
|
|
|