|
Hi, I've an asp:calendar, I would like to highlight a date for an event on it.
For example: on 18th april 2010, I wish the date was highlighted, and when the mouse passes over I want that appear the description of the event(eg:"Tonight live concert")!
How do I proceed? Help me!
|
|
|
|
|
For highlighting a day, you have to attach OnDayRender event to your calendar.This will be called for all the dates visible in the calendar.You need to check the date in this function and add the style as you want.You can also show the description as tooltip as below
e.Cell.ToolTip = "Tonight live concert";
Let me know if you have any query.
Also you can go through a good article on the same topic Click hereCheers!!
Brij
|
|
|
|
|
|
I'm working on a database-driven food pantry application which will allow a user to add a new household to the database. The user would theoretically add members to this household by using a modal popup form to add a new family member by either entering new information in a form, or search for a person who is already in the system but is not assigned to a household. The new family member would be added to a datable which is then databinded to a gridview. When the household information is saved, we theoretically add everyone in the datable to the newly created household by changing their HHID (the foreign key in the database linking them to the database) to that of the newly created household. It makes use of Ajax update panels to dynamically add data without reloading the page.
Now here is where the problem comes into play: when the user adds the new family member (either by searching or entering new data), the datatable is cleaned out, and only the newly created family member shows up. My code is as follows:
This function is what actually puts the data into the datatable.
protected void AddNewFamilyMemberToDatatable(string SSN, string First, string Last, string DOB, string AdultChild, string Gender, bool Head, String ConsentForm, string Ethnicity)
{
FamilyWarning.Text += "<br/>There are now" + NewHouseholdDatatable.Rows.Count.ToString() + " rows in the table before adding empty columns and after getting changes";
AddEmptyColumnsToDatatable(NewHouseholdDatatable);
FamilyWarning.Text += "<br/>There are now" + NewHouseholdDatatable.Rows.Count.ToString() + " rows in the table after adding empty columsn";
FamilyWarning.Text += "<br/>There are now" + NewHouseholdDatatable.Rows.Count.ToString() + " rows in the table after assigning datasource";
DataRow Row = NewHouseholdDatatable.NewRow();
if (Head)
{
Row["HeadOfHousehold"] = true;
}
else
{
Row["HeadOfHousehold"] = false;
}
Row["Firstname"] = First;
Row["DOB"] = DOB;
Row["Lastname"] = Last;
Row["SSN"] = SSN;
Row["AdultChild"] = AdultChild;
Row["MaleFemale"] = Gender;
if (ConsentForm == "1")
{ Row["ConsentForm"] = true; }
else
{ Row["ConsentForm"] = false; }
Row["Ethnicity"] = Ethnicity;
if (!CheckIsDate(DOB))
{
Row["Age"] = 0;
Row["DateOfBirth"] = "Unknown, please edit and enter proper data";
}
else
{
Row["Age"] = GetAge(DateTime.Parse(DOB));
DateTime DateAndTimeOfBirth = Convert.ToDateTime(DOB);
Row["DateOfBirth"] = DateAndTimeOfBirth.ToShortDateString();
}
try
{
FamilyWarning.Text += "<br/>There are " + NewHouseholdDatatable.Rows.Count.ToString() + " rows in the table before adding";
NewHouseholdDatatable.Rows.Add(Row);
FamilyWarning.Text += "<br/>There are now" + NewHouseholdDatatable.Rows.Count.ToString() + " rows in the table after accepting changes";
ClearForm();
FamilyMembers.DataSource = NewHouseholdDatatable;
FamilyMembers.DataBind();
FamilyWarning.Text += "<br/>There are now" + NewHouseholdDatatable.Rows.Count.ToString() + " rows in the table after databinding";
}
catch (Exception ex)
{
FamilyWarning.Text += "<br/>Unable to add this person to the table, " + ex.Message;
}
}
|
|
|
|
|
I guess AddEmptyColumnsToDatatable(NewHouseholdDatatable); something wrong is going on.
please put a breakpoint on the line and see if after executing this line, the Datatable remains the same.
|
|
|
|
|
That didn't work. Here is the code to the add empty columns function though
protected void AddEmptyColumnsToDatatable(DataTable datatable)
{
if (!datatable.Columns.Contains("HeadOfHousehold"))
{
DataColumn HeadOfHousehold = new DataColumn("HeadOfHousehold", Type.GetType("System.Boolean"));
datatable.Columns.Add(HeadOfHousehold);
}
if (!datatable.Columns.Contains("Age"))
{
DataColumn Age = new DataColumn("Age", Type.GetType("System.Int32"));
datatable.Columns.Add(Age);
}
if (!datatable.Columns.Contains("DateOfBirth"))
{
DataColumn DateOfBirth = new DataColumn("DateOfBirth", Type.GetType("System.String"));
datatable.Columns.Add(DateOfBirth);
}
if (!datatable.Columns.Contains("Firstname"))
{
DataColumn DateOfBirth = new DataColumn("Firstname", Type.GetType("System.String"));
datatable.Columns.Add(DateOfBirth);
}
if (!datatable.Columns.Contains("Lastname"))
{
DataColumn DateOfBirth = new DataColumn("Lastname", Type.GetType("System.String"));
datatable.Columns.Add(DateOfBirth);
}
if (!datatable.Columns.Contains("SSN"))
{
DataColumn DateOfBirth = new DataColumn("SSN", Type.GetType("System.String"));
datatable.Columns.Add(DateOfBirth);
}
if (!datatable.Columns.Contains("DOB"))
{
DataColumn DateOfBirth = new DataColumn("DOB", Type.GetType("System.String"));
datatable.Columns.Add(DateOfBirth);
}
if (!datatable.Columns.Contains("AdultChild"))
{
DataColumn DateOfBirth = new DataColumn("AdultChild", Type.GetType("System.String"));
datatable.Columns.Add(DateOfBirth);
}
if (!datatable.Columns.Contains("MaleFemale"))
{
DataColumn DateOfBirth = new DataColumn("MaleFemale", Type.GetType("System.String"));
datatable.Columns.Add(DateOfBirth);
}
if (!datatable.Columns.Contains("ConsentForm"))
{
DataColumn DateOfBirth = new DataColumn("ConsentForm", Type.GetType("System.Boolean"));
datatable.Columns.Add(DateOfBirth);
}
if (!datatable.Columns.Contains("Ethnicity"))
{
DataColumn DateOfBirth = new DataColumn("Ethnicity", Type.GetType("System.String"));
datatable.Columns.Add(DateOfBirth);
}
}
|
|
|
|
|
Nevermind, I solved it. My problem was that whenever I did an Ajax postback, the entire table would be lost, not emptied. So all I had to do was copy it to a viewstate, and then reload it from the viewstate. It goes as follows:
NewHouseholdDatatable = new DataTable();
AddEmptyColumnsToDatatable(NewHouseholdDatatable);
Then I changed my adding code to the following:
protected void AddNewFamilyMemberToDatatable(string SSN, string First, string Last, string DOB, string AdultChild, string Gender, bool Head, String ConsentForm, string Ethnicity)
{
if (ViewState["NewHouseholdDatatable"] != null)
{
NewHouseholdDatatable = (DataTable)ViewState["NewHouseholdDatatable"];
AddEmptyColumnsToDatatable(NewHouseholdDatatable);
}
else
{
NewHouseholdDatatable = new DataTable();
AddEmptyColumnsToDatatable(NewHouseholdDatatable);
}
FamilyWarning.Text += "<br/>There are now" + NewHouseholdDatatable.Rows.Count.ToString() + " rows in the table after adding empty columsn";
FamilyWarning.Text += "<br/>There are now" + NewHouseholdDatatable.Rows.Count.ToString() + " rows in the table after assigning datasource";
DataRow Row = NewHouseholdDatatable.NewRow();
if (Head)
{
Row["HeadOfHousehold"] = true;
}
else
{
Row["HeadOfHousehold"] = false;
}
Row["Firstname"] = First;
Row["DOB"] = DOB;
Row["Lastname"] = Last;
Row["SSN"] = SSN;
Row["AdultChild"] = AdultChild;
Row["MaleFemale"] = Gender;
if (ConsentForm == "1")
{ Row["ConsentForm"] = true; }
else
{ Row["ConsentForm"] = false; }
Row["Ethnicity"] = Ethnicity;
if (!CheckIsDate(DOB))
{
Row["Age"] = 0;
Row["DateOfBirth"] = "Unknown, please edit and enter proper data";
}
else
{
Row["Age"] = GetAge(DateTime.Parse(DOB));
DateTime DateAndTimeOfBirth = Convert.ToDateTime(DOB);
Row["DateOfBirth"] = DateAndTimeOfBirth.ToShortDateString();
}
try
{
FamilyWarning.Text += "<br/>There are " + NewHouseholdDatatable.Rows.Count.ToString() + " rows in the table before adding";
NewHouseholdDatatable.Rows.Add(Row);
FamilyWarning.Text += "<br/>There are now" + NewHouseholdDatatable.Rows.Count.ToString() + " rows in the table after accepting changes";
ClearForm();
ViewState["NewHouseholdDatatable"] = NewHouseholdDatatable;
FamilyMembers.DataSource = NewHouseholdDatatable;
FamilyMembers.DataBind();
FamilyWarning.Text += "<br/>There are now" + NewHouseholdDatatable.Rows.Count.ToString() + " rows in the table after databinding";
}
catch (Exception ex)
{
FamilyWarning.Text += "<br/>Unable to add this person to the table, " + ex.Message;
}
}
|
|
|
|
|
sir,
i want to bind records to a datalist control. i want to show records when any user clicks on a button named btnShowRec_Click().
..i wrote a piece of code below but it is not showing records at runtime
protected void btnShowRec_Click(object sender, EventArgs e)
{
if (!IsPostBack)
{
string sqlgrid = "select * from ebay where category='" + ddlCatg.SelectedItem.Value + "'";
cmd = new SqlCommand(sqlgrid, conn);
conn.Open();
dtlstEbay.DataSource = cmd.ExecuteReader();
dtlstEbay.DataBind();
conn.Close();
conn.Dispose();
}
dtlstEbay is the name of data list control.i have also binded with #Eval with each column in source page but not getting desirable output..
|
|
|
|
|
IsPostBack evaluates to true if the page is posted back from the client. In fact, in your case you want when the button is clicked, you need to bind data.
Thus in your case IsPostBack will evaluates to true. !IsPostBack will be false.
Hence the entire code will be bypassed.
|
|
|
|
|
still it is not showing records in click event.
|
|
|
|
|
Well, I would recommend you to put a breakpoint on the code, and see what exactly is happening there. Is it actually called correctly, does it connect to the Database, does it runs the Command correctly.
Just put a breakpoint, and run it line by line, and inspect each of the lines minutely to debug the application.
|
|
|
|
|
As btnShowRec_Click should always trigger on postback, its useless to put
if(!IsPostBack) over here.
remove your if(!IsPostBack) condition then your code will execute.
|
|
|
|
|
i removed that bt still it is not showing records. in fact in drop down menu categories can be seen dat means, it is getting records from database dn why it is not showing on click event. ???
|
|
|
|
|
As Abhishek suggested, put the breakpoint and try to find out which line of your code is creating problem.
|
|
|
|
|
Trying to protect a web service by reading a client certificate in order to validate the client but all of the articles I've Googled are connecting to a web service with a client certificate.
Does anyone know of an article or book that has an example of creating a web service that verifies a client certificate and denies all non-validated requests?
|
|
|
|
|
In IIS enable accept client-side certificates. You can then map the certificates to Windows logins through IIS and use Windows Role Based Security.
In II6 click the properties for your web service, click directory security, in secure communications click edit, check enable client certificate mapping, click edit, map users.
|
|
|
|
|
Have IIS configured and calling the web service with the following code:
string cert_path = @"C:\cert.cer";
web_service.ClientCertificates.Add(X509Certificate.CreateFromCertFile(cert_path));
How do I verify that the client certificate sent is valid on the web service?
|
|
|
|
|
|
|
I am using a client certificate that was provided by a well known CA. Even when trying to access the site with IE (with the client certificate installed in the Other tab) I get the 403 error, requires client certificate.
|
|
|
|
|
hi freds..
I am facing an issue in gridview control(asp.Net,c#), see below code panel
<asp:TemplateField HeaderText="Action">
<ItemTemplate>
<asp:ImageButton ID="imgLiveTest" CommandName="<%#DataBinder.Eval(Container.DataItem,"type")%>"
ImageUrl='<%# GetImageTestLive(DataBinder.Eval(Container.DataItem,"liveServer")) %>'
OnClick="imgLiveTest_click" runat="server" />
<asp:ImageButton ID="Edit" CommandName="<%#DataBinder.Eval(Container.DataItem,"type")%>"
OnClick="Edit_click" ImageUrl="images/edit.gif" runat="server" />
<asp:ImageButton ID="Delete" CommandName="<%#DataBinder.Eval(Container.DataItem,"type")%>"
OnClick="delete_click" ImageUrl="images/cancel.gif" runat="server" />
</ItemTemplate>
</asp:TemplateField>
But I am not able to to see image in gridview, where as path is correct, and in source code ImageButton not renderd as html code they are same as aspx.
Thanks,
Abbas
|
|
|
|
|
Just right click on the image control (which is rendered as no image) and see if the path that its src has can be accessible by directly putting in the browser.
You need to have access previledge to a path from the client to see the image.
Also why do you use :
ImageUrl='<%# GetImageTestLive(DataBinder.Eval(Container.DataItem,"liveServer")) %>'
single quote here while using double quote for all others.
|
|
|
|
|
hi Abhi thanks for answer, actually i was using image path according function returns value, but now we using RowCreated event thats working fine.
Thanks,
|
|
|
|
|
Oh this is great to hear that it solved.
Cheers
|
|
|
|
|
I have a Ajax tab control that is working fine in Internet Explorer but not working in Mozilla.
Tab control is resides in a user control, calling on a *.aspx page.
My page have Two panels .
1) Tab control User control in one Panel.
2) On clicking of Tab control functionality perform on another Panel on the same page.
Please, Provide me solution for that.
nikki
|
|
|
|