|
Hi,
How do i calculate the Start_cell_number and end_cell_number from Start_Display_datetime and end_display_datetime calcultion.
here is my code .
TimeSpan timeSpan1 = TimeSpan.Parse("8:00");//8:00 AM Start_dispaly_dateitme
TimeSpan timeSpan2 = TimeSpan.Parse("9:00");// 9:00 AM end_display_datetime
TimeSpan timeSpanDiff = timeSpan2.Subtract(timeSpan1);//hours difference
int mins = timeSpanDiff.Hours * 60 + timeSpanDiff.Minutes;//total minutes
int cells = mins / 15;//count number of cells
Now how i calculate the Start_cell_number and end_cell _number ?
first cell contains name of machines and from second cell i have to calculate .
i have 32 cells in a row .
Any hint is highly apperciated.
Best regards
Rameez
|
|
|
|
|
Nobody is going to answer you unless you give a clear picture.
Your question is 100% empty.
What you mean by,
rameez Raja wrote: Start_Display_datetime
rameez Raja wrote: end_display_datetime
rameez Raja wrote: Start_cell_number
rameez Raja wrote: end_cell_number
What type of cell it is?
Can you please explain your exact problem?
EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.
|
|
|
|
|
Thanks for ur reply .
Dear i have one table which contains 32 row cells. from 8:00AM to 3:00PM with interval of 15 minutes .
start from 8:00AM to 03:00PM each hour contains four cells.
i have reservation from 8:00AM to 10:00AM
like this
startReservetime
TimeSpan timeSpan1 = TimeSpan.Parse("8:00");//8:00 AM Startdatetime
TimeSpan timeSpan2 = TimeSpan.Parse("9:00");//3:00 PM end_display_datetime
TimeSpan timeSpanDiff = timeSpan2.Subtract(timeSpan1);//hours difference
int mins = timeSpanDiff.Hours * 60 + timeSpanDiff.Minutes;//total minutes
int cells = mins / 15;//count number of cells
same way i calculated endreservetime
Now i want to figure out the start_cell_number and end_cell_number of reserved vehicle as i can colour the cells .
please give me hint how i do that .
Best regards
Rameez
modified on Thursday, July 17, 2008 8:31 AM
|
|
|
|
|
Hi,
I am having a string with html tags. When I try to display it on the browser it comes along with those tags. I want to display only string with out html tags.
Please give me a solution.
VJ
|
|
|
|
|
tovijay.shukla wrote: When I try to display it on the browser it comes along with those tags
In which control are your trying to display that text?
tovijay.shukla wrote: I want to display only string with out html tags.
You can take DIV control or Label also
please don't forget to vote on the post that helped you.
|
|
|
|
|
Are you using those string inside a GridView? If yes, you should use HTMLEncode property of the GridViewColumn to display it properly. Use the "Edit Column" option in the Smart Tag in design mode
|
|
|
|
|
No I am just displaying it in a repeater.
|
|
|
|
|
Got the solution. Server.HtmlDecode can Decode the same
Thanks,
|
|
|
|
|
tovijay.shukla wrote: Got the solution. Server.HtmlDecode can Decode the same
You did mark my previous post as bad answer but that was not my mistake.It was your mistake if you can not explain you question clearly so nobody can give you perfect solution.Remember if you do not understand answer,do not mark answer as unhelpful.
please don't forget to vote on the post that helped you.
|
|
|
|
|
Hi, I am newbie and I came across with several email validation sample codes by using socket programing. I followed the instruction and the sample codes but I failed to connect to the socket either..pls help~
I was stucked at:
public static bool validate(string e_mail) <--- e_mail input as "support@microsoft.com"
{
string[] tex1 = e_mail.Split(new char[] { '@' });
IPHostEntry IPhst = Dns.GetHostEntry(tex1[1]);
IPEndPoint endPt = new IPEndPoint(IPhst.AddressList[0], 26);
Socket s = new Socket(endPt.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
s.Connect(endPt); <---- error here
....
....
}
I am using port 26 as my ISP provider is blocking my port 25..
I got this returned :"A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 207.46.197.32:26"
Please help~~Thank you.
Lengdor
|
|
|
|
|
i need to allow our users to select 6 items from a larger list. i want to implement ajax. but i'am new to it.
i dont want to use lists exactly. what i need is that the items will be displayed as images. i want the user to drag from the larger list to the list he prefers. also i might want the user to re arrange the list he has created.
I have no idea of how ajax works.
i would appreciate if anyone can give me suggestions
Balaji
|
|
|
|
|
I would start here
http://www.asp.net/ajax/
then download this:
http://www.asp.net/ajax/ajaxcontroltoolkit/samples/
|
|
|
|
|
What is wrong with this post?
|
|
|
|
|
Hi,
i want to create the custom templated databound control which will behave like a menu.
Is there anyone did like above functionality?
Thanks in advance.....
Sumukh
sam
|
|
|
|
|
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server" CellPadding="4" DataKeyNames="Productid" ShowFooter ="True"
ForeColor="#333333" GridLines="None" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" AutoGenerateColumns="False" OnRowUpdated="GridView1_RowUpdated" OnRowUpdating="GridView1_RowUpdating" OnRowEditing="GridView1_RowEditing" OnSelectedIndexChanging="GridView1_SelectedIndexChanging">
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#EFF3FB" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#2461BF" />
<AlternatingRowStyle BackColor="White" />
<Columns >
<asp:TemplateField HeaderText ="Productid" InsertVisible ="False" SortExpression ="Productid" >
<ItemTemplate >
<asp:Label ID="lblProductid" runat ="server" Text='<%# Eval("Productid") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText ="ProductCode" SortExpression ="ProductCode" InsertVisible ="False" >
<EditItemTemplate >
<asp:TextBox ID ="txtProductCode" runat ="server" Text ='<%#Bind("ProductCode") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblProductCode" runat ="server" Text='<%#Eval("ProductCode") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate >
<asp:TextBox ID="txtfooterProductCode" runat="server" > </asp:TextBox>
<asp:RequiredFieldValidator ID="rfvProductCode" runat="server" ControlToValidate="txtfooterProductCode" ErrorMessage="*"></asp:RequiredFieldValidator>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText ="ProductName" InsertVisible ="False" SortExpression ="ProductName">
<EditItemTemplate >
<asp:TextBox ID="txtProductName" runat ="server" Text='<%#Bind("ProductName") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate >
<asp:Label ID ="lblProductName" runat ="server" Text='<%#Eval("ProductName") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtfooterProductName" runat="server" > </asp:TextBox>
<asp:RequiredFieldValidator ID="rfvProductName" runat="server" ControlToValidate="txtfooterProductName" ErrorMessage="*"></asp:RequiredFieldValidator>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText ="ProductDescription" InsertVisible ="False" SortExpression ="ProductDescription">
<EditItemTemplate >
<asp:TextBox ID="txtProductDescription" runat ="server" Text ='<%#Bind("ProductDescription") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate >
<asp:Label ID ="lblProductDescription" runat ="server" Text ='<%# Eval("ProductDescription") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate >
<asp:TextBox ID="txtProductDescription" runat ="server" ></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvProductDescription" runat="server" ControlToValidate="txtProductDescription" ErrorMessage="*"></asp:RequiredFieldValidator>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="EditRecord">
<EditItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update"
Text="Update"></asp:LinkButton>
<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel"
Text="Cancel"></asp:LinkButton>
</EditItemTemplate>
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit"
Text="Edit"></asp:LinkButton>
</ItemTemplate>
<FooterTemplate>
<asp:LinkButton ID="lnkInsert" runat="server" Text ="Insert" OnClick="lnkInsert_Click"></asp:LinkButton>
</FooterTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:Label ID="lblMessage" runat="server" Text ="Insert Record Successfully" Visible ="false" > </asp:Label>
</div>
</form>
code behind
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;
using System.Data.SqlClient;
public partial class HOMEME_AddRowGrid : System.Web.UI.Page
{
SqlCommand cmd = new SqlCommand();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Binddata();
}
}
public void Binddata()
{
string sqlQuery = "SELECT * from Product";
SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]);
SqlDataAdapter sda = new SqlDataAdapter(sqlQuery, conn);
DataTable dtData = new DataTable();
sda.Fill(dtData);
GridView1.DataSource = dtData.DefaultView;
GridView1.DataBind();
}
protected void lnkInsert_Click(object sender, EventArgs e)
{
TextBox txtfooterProductCode = GridView1.FindControl("txtfooterProductCode") as TextBox;
TextBox txtfooterProductName = GridView1.FindControl("txtfooterProductName") as TextBox;
TextBox txtProductDescription = GridView1.FindControl("txtProductDescription") as TextBox;
SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]);
conn.Open();
cmd = new SqlCommand("InsertProduct", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@ProductCode", SqlDbType.VarChar).Value = ((TextBox)GridView1.FooterRow.FindControl("txtfooterProductCode")).Text;
cmd.Parameters.Add("@ProductName", SqlDbType.VarChar).Value = ((TextBox)GridView1.FooterRow.FindControl("txtfooterProductName")).Text;
cmd.Parameters.Add("@ProductDescription", SqlDbType.VarChar).Value = ((TextBox)GridView1.FooterRow.FindControl("txtProductDescription")).Text;
cmd.ExecuteNonQuery();
conn.Close();
Binddata();
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void GridView1_RowUpdated(object sender, GridViewUpdatedEventArgs e)
{
}
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
//int Productid = ((Label)GridView1.Rows[e.RowIndex].FindControl("lblProductid").Text);
// TextBox txtProductCode = GridView1.FindControl("txtProductCode") as TextBox;
// TextBox txtProductName = GridView1.FindControl("txtProductName") as TextBox;
// TextBox txtProductDescription = GridView1.FindControl("txtProductDescription") as TextBox;
// SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]);
// conn.Open();
// cmd = new SqlCommand("UpdateProduct", conn);
// cmd.CommandType = CommandType.StoredProcedure;
// //cmd.Parameters.AddWithValue("Productid", SqlDbType.VarChar).Value
// cmd.Parameters.AddWithValue("Productid", GridView1.DataKeys["Productid"]);
// cmd.Parameters.Add("@ProductCode", SqlDbType.VarChar).Value = ((TextBox)GridView1.FooterRow.FindControl("txtProductCode")).Text;
// cmd.Parameters.Add("@ProductName", SqlDbType.VarChar).Value = ((TextBox)GridView1.FooterRow.FindControl("txtProductName")).Text;
// cmd.Parameters.Add("@ProductDescription", SqlDbType.VarChar).Value = ((TextBox)GridView1.FooterRow.FindControl("txtProductDescription")).Text;
// cmd.ExecuteNonQuery();
// conn.Close();
// Binddata();
}
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
}
protected void GridView1_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
{
}
}
help-- how we update delete in gridview using storeporocedure
CREATE PROCEDURE [UpdateProduct]
@ProductCode VARCHAR(50),
@productName VARCHAR(50),
@ProductDescription VARCHAR(500),
@Productid numeric
AS
update Product set ProductCode=@ProductCode,productName =@productName,ProductDescription =@ProductDescription where Productid=@Productid
GO
pls sent code to my id
|
|
|
|
|
what do you expect from other forum members?
What is your exact problem. After 6 highways of code I don't see your problem
|
|
|
|
|
update , delete not working,i am using store procedure pls help me
|
|
|
|
|
What I see in your SqlParameter usage is that you expect that the rowdata is found in the footerrow. That may be for new data but for data loaded from a DB you need the objects used in the row.
For the correct usage of UPDATE and DELETE, search Google or use the ask the SQL forum of CodeProject
|
|
|
|
|
Hello friends,
I am adding some checkboxes dynamically by following method:
Dim chk As New CheckBox
chk.ID = "Random String"
chk.Text = "Random String"
chk.AutoPostBack = True
AddHandler chk.CheckedChanged, AddressOf chkSelected_CheckedChanged
Page.Form.Controls.Add(chk)
I have also added event handler of checkbox as:
Protected Sub chkSelected_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs)
Response.Write(" " & sender.Checked)
End Sub
I am also trying to access these controls by FindControl() method as ".netman" told to.
But the problem is i am not able to check or uncheck those checkboxes and also those are not showing in FindControl() method.
I even tried to create controls in Page_Init method but its still not working.
Can anybody tell me what is wrong?
Thanks and Regards,
Nagendra
|
|
|
|
|
nagendrathecoder wrote: But the problem is i am not able to check or uncheck those checkboxes and also those are not showing in FindControl() method.
Try this sample.This is working.
I take one PlaceHolder and one button control on page.
On Page_Load event,I create two checkboxes
protected void Page_Load(object sender, EventArgs e)
{
CreateCheckBox();
if (!IsPostBack)
{
}
}
Create Checkbox Method
public void CreateCheckBox()
{
CheckBox chk;
for (int i = 0; i < 2; i++)
{
chk = new CheckBox();
chk.ID = "chk_" + i.ToString();
chk.AutoPostBack = true;
PL.Controls.Add(chk);
}
}
Now I check status of checkbox on Button Click event.
protected void btn_Click(object sender, EventArgs e)
{
for (int i = 0; i < 2; i++)
{
Response.Write(((CheckBox)this.Page.FindControl("chk_" + i.ToString())).Checked);
}
}
Note: You need to create checkboxes on every event of the page so I call that method out of IsPostBack condition.
please don't forget to vote on the post that helped you.
modified on Wednesday, July 16, 2008 6:53 AM
|
|
|
|
|
Hello friends,
If u have any idea of ASP.NET caching please send to me with examples.
Regards
anu :)
anu
modified on Wednesday, July 16, 2008 5:59 AM
|
|
|
|
|
Asp.Net Caching
SSK.
Anyone who says sunshine brings happiness has never danced in the rain.
|
|
|
|
|
please use google to research information like this
|
|
|
|
|
|
Hi
In my update panel I display a gridview but the paging doesnt work.
When I click on a number at the bottom it doesnt do anything
Why would this be?
thanks
|
|
|
|