|
string query = "select * from appointment where DATE >'" + selectedDate.ToShortDateString() + "' AND DATE<'" + sel.ToShortDateString() + "'";
|
|
|
|
|
Hi to all,
I am stucked in a problem. I have a gridview in which there are two button columns.
On button click I want image to open in fax viewer. I tried like this.
But the problem is that the foreach is going through all the rows. I want that if a user clicks on a certain button then it should open the corresponding image.
Please assist me...
<br />
<asp:GridView ID="GridView1" runat="server" BackColor="White" DataKeyNames="UniqueID" <br />
BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" <br />
AutoGenerateColumns="False"><br />
<RowStyle ForeColor="#000000" /><br />
<FooterStyle BackColor="White" ForeColor="#000066" /><br />
<PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" /><br />
<SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" /><br />
<HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" /><br />
<Columns><br />
<br />
<asp:TemplateField HeaderStyle-Width="50px" HeaderText="SrNo" InsertVisible="False" SortExpression="SrNo"><br />
<ItemTemplate><br />
<asp:Label ID="SrNoLabel" runat="server" Text='<%# Bind("SrNo") %>'></asp:Label><br />
</ItemTemplate><br />
<HeaderStyle Width="50px"></HeaderStyle><br />
</asp:TemplateField><br />
<br />
<asp:TemplateField HeaderStyle-Width="50px" HeaderText="UniqueID" InsertVisible="False" SortExpression="UniqueID"><br />
<ItemTemplate><br />
<asp:Label ID="UniqueIDLabel" runat="server" Text='<%# Bind("UniqueID") %>'></asp:Label><br />
</ItemTemplate><br />
<HeaderStyle Width="50px"></HeaderStyle><br />
</asp:TemplateField><br />
<br />
<asp:TemplateField HeaderStyle-Width="50px" HeaderText="BridgeNo" InsertVisible="False" SortExpression="BridgeNo"><br />
<ItemTemplate><br />
<asp:Label ID="BridgeNoLabel" runat="server" Text='<%# Bind("BridgeNo") %>'></asp:Label><br />
</ItemTemplate><br />
<HeaderStyle Width="50px"></HeaderStyle><br />
</asp:TemplateField><br />
<br />
<asp:TemplateField HeaderStyle-Width="50px" ItemStyle-HorizontalAlign="Left" HeaderText="PlanNo" InsertVisible="False" SortExpression="PlanNo"><br />
<ItemTemplate><br />
<asp:Label ID="PlanNoLabel" runat="server" Text='<%# Bind("PlanNo") %>'></asp:Label><br />
</ItemTemplate><br />
<HeaderStyle Width="50px"></HeaderStyle><br />
</asp:TemplateField><br />
<br />
<asp:TemplateField HeaderStyle-Width="180px" ItemStyle-HorizontalAlign="Left" HeaderText="Description" InsertVisible="False" SortExpression="Description"><br />
<ItemTemplate><br />
<asp:TextBox ID="DescriptionTextBox" Enabled="false" TextMode="MultiLine" runat="server" Text='<%# Bind("Description") %>'></asp:TextBox><br />
</ItemTemplate><br />
<HeaderStyle Width="180px"></HeaderStyle><br />
</asp:TemplateField><br />
<br />
<asp:TemplateField HeaderStyle-Width="50px" HeaderText="OldUniqueID" InsertVisible="False" SortExpression="OldUniqueID"><br />
<ItemTemplate><br />
<asp:Label ID="OldUniqueIDLabel" runat="server" Text='<%# Bind("OldUniqueID") %>'></asp:Label><br />
</ItemTemplate><br />
<HeaderStyle Width="50px"></HeaderStyle><br />
</asp:TemplateField><br />
<br />
<asp:TemplateField HeaderStyle-Width="80px" HeaderText="Image" InsertVisible="False" SortExpression="Image"><br />
<ItemTemplate><br />
<asp:Button ID="ButtonImg" runat="server" Width="80px" ToolTip='<%# Bind("Image") %>' Text="New Image" OnClick="On_Click" ></asp:Button><br />
</ItemTemplate><br />
<HeaderStyle Width="80px"></HeaderStyle><br />
</asp:TemplateField><br />
<br />
<asp:TemplateField HeaderStyle-Width="80px" HeaderText="OldImage" InsertVisible="False" SortExpression="OldImage"><br />
<ItemTemplate><br />
<asp:Button ID="ButtonOldImage" runat="server" Width="80px" ToolTip='<%# Bind("OldImage") %>' Text="Raw Image" OnClick="By_Click" ></asp:Button><br />
</ItemTemplate><br />
<HeaderStyle Width="80px"></HeaderStyle><br />
</asp:TemplateField><br />
<br />
</Columns><br />
</asp:GridView><br />
protected void On_Click(object sender, EventArgs e)
{
foreach (GridViewRow rowitem in GridView1.Rows)
{
Button ButtonImg = (Button)rowitem.Cells[6].FindControl("ButtonImg");
btntext = ButtonImg.ToolTip.ToString();
final_text = Server.MapPath(btntext);
}
System.Diagnostics.Process.Start(final_text);
}
cheers,
sneha
|
|
|
|
|
System.Diagnostics.Process.Start(final_text);
will act as Start -->Run--> prompt
I am Not Sure This Will Work Or Not But Try It
Process.Start("UrPictureViewerExePathToInvoke" + imagePath)
in my system
UrPictureViewerExePathToInvoke= rundll32.exe C:\WINDOWS\system32\shimgvw.dll,ImageView_Fullscreen
Convert the code in C# and Do it
modified on Friday, September 4, 2009 8:30 AM
|
|
|
|
|
while i was developing an application in asp.net i got the warning message as
"Validation (XHTML 1.0 Transitional): Element 'font' is considered outdated. A newer construct is recommended"
what is the alternative for this?
|
|
|
|
|
|
Use CSS
only two letters away from being an asset
|
|
|
|
|
Dear Sir,
Hi,
I want create application like outlook as in windows.
Aplicataion will read email through
smtp.
Any body have some idea how to read emails
from gmail, or yahoo.
In short appliction like outlook.
Thank You
|
|
|
|
|
|
manish.m.meshram wrote: I want create application like outlook as in windows.
Good start, a clear definition of your requirements
manish.m.meshram wrote: Any body have some idea how to read emails
Doomed from this point on. If you don't know how to read emails, and can't be bothered to look at the faqs for gmail and yahoo, how are you going to do it?
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
hi
how can i get the output of a control (for example GridView) ,in image format.
|
|
|
|
|
|
hi every body
iwant to ask how can i implement communication between 2 web sites first web asks the second about some information and the other also keeps a record of information about clients (web pages) that connected with it.
its just like central server and clients connecting to it h dont know realy how to do this in asp.net
please help me with the code or give me an example.
thanks
|
|
|
|
|
There is no direct way to communicate between two websites. Here are few possible methods.
- Provide a web service for each website. So one website can use other website's web service to get data
- Use a centralized database which each website uses. You can just query on this DB to get latest updates.
|
|
|
|
|
Using WebService is a good option.
|
|
|
|
|
TextBox2.Text = selectedDate.DayOfWeek.ToString();
TextBox3.Text = selectedDate.ToShortDateString();
string connection2 = ConfigurationManager.AppSettings["conn"];
OleDbConnection con2 = new OleDbConnection(connection2);
OleDbDataAdapter da_detail = new OleDbDataAdapter();
DataSet ds_detail = new DataSet();
con2.Open();
//da_detail.Fill(ds_detail, "details");
//DataTable detail_dt = ds_detail.Tables["details"];
string query = "select * from appointment where DATE = '" + selectedDate.ToShortDateString() + "' ";
OleDbCommand pay_cmd2 = new OleDbCommand(query, con2);
DataRow row = null;
for (int x = 1; x <= 7; x++)
{
da_detail.SelectCommand = pay_cmd2;
//row = detail_dt.NewRow();
da_detail.Fill(ds_detail, "details");
detail_dt=ds_detail.Tables["details"];
//detail_dt.Rows.Add(row);
DateTime tempo = selectedDate.AddDays(1);
selectedDate = tempo;
}
GridView1.DataSource = detail_dt;
GridView1.DataBind();
this is the code.i want show the details of the whole week.but the code is not working.can u help me.
|
|
|
|
|
Why do you say its not working ? Do you get any sort of Error ?
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
the gridview is not displayed..i think its not getting any data.but the query is correct.it will fetch datas.some prob with datatable
|
|
|
|
|
Why you dont use TOP 7 insetead using for loop?
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
but the prob is not coz of loop.its because datas r not getting appended in datatable.
|
|
|
|
|
ok i looked at the code , i dont understand why you loop. ok i see you fill the dataset and you give the name, now take that name use it in the grid's datamember property and try it again.
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
What a load of crap! Seriously, you code is flawed.
You don't need a for loop here. Add 7 days to the date and have only one query. Also just for displaying to grid, you don't need a DataSet. A simple reader should do. Here is the code with some improvements.
string connectionString = ConfigurationManager.AppSettings["conn"];
string query = "select * from appointment where DATE >= @StartDate and DATE <= @EndDate";
using(OleDbConnection connection = new OleDbConnection(connectionString))
using(OleDbCommand command = new OleDbCommand(query, connection);
{
command.Parameters.AddWithValue("@StartDate", selectedDate.ToShortDateString());
command.Parameters.AddWithValue("@EndDate", selectedDate.AddDays(7).ToShortDateString());
connection.Open();
using(OleDbDataReader reader = command.ExecuteReader())
{
GridView1.DataSource = reader;
GridView1.DataBind();
}
connection.Close();
} Note: Code written directly on CP editor. You may need to correct some compilation errors.
|
|
|
|
|
I am developing an application in ASP.NET. I need to do two things:
1- The user who logges in the application (through my login.aspx page) must also be authenticated by Active Directory since every user is also registered on AD and has the same user name.
2- After login, the application must run under his AD account instead of anonymous user, IUSR_MachineName.
any code example will be highly appreciated. Thanks
|
|
|
|
|
Which Authentication you are using?
|
|
|
|
|
I have set both Integrated Windows Authentication and anonymous access in app setting from IIS console.
|
|
|
|
|
I have a need to gather data from an Excel spreadsheet, I have no information about the sheet but I want the user to be able to link a cell in a datagrid or a text control to a cell in an excel spreadsheet.
I have looked at some of the spreadsheet controls and have found no mention of remote referencing capability.
I could set up the read capability if it was winforms but am I going to be limited by the lack of IO via the browser.
|
|
|
|