|
Hi
I am creating a custom sever control. I have property with name selected color i wana bound this property with Color editor. So user can select color in color window any who can help me.
Thanks
Vicky
|
|
|
|
|
In design time correct? If you use Color[^] structure, the IDE will show color picker.
|
|
|
|
|
I would like to load pages according to the value selected within a list, for example:
<code>
protected void Button2_Click(object sender, EventArgs e)
{
if (lstTaskCategory.Text.Equals("User Experience")) {
//Load Task_entry_2_user_experience.aspx
}
else if (lstTaskCategory.Text.Equals("Localization")) {
//Load Task_entry_2_localization.aspx
}
else if (lstTaskCategory.Text.Equals("Documentation") {
//Load Task_entry_2_documentation.aspx
}
}
</code>
More questions...
Is it also possible to do the above as a dynamic hyperlink (i.e. have a hyperlink that automatically updates a value within
<a href="page.aspx"> Next </a>.
In my case the value of <page.aspx> would change according to the value in lst.TaskCategory.Text.
Jon
|
|
|
|
|
Well, for starters you could use a switch statement. If it's a list, you could also use the data field to store the URLs.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
A switch statement will do the job as well, however I'm not sure what command to execute, would you have a code sample?
Jon
|
|
|
|
|
Oh, you're looking for Response.Redirect ? I suggest you buy an ASP.NET book to help you with the basics, or you'll find you'll spend a lot of time posting here and waiting for answers when you could be making progress.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Thanks. I had been scouting the web and books, but I must have skipped this part
"Blonde moment"
Jon
|
|
|
|
|
Hi guys I am getting this wird error message
An invalid character was found in text content. Error processing resource 'http://localhost/myweb/source/a2.aspx...
if i take out the Response.ContentType then i am able to view the image but i don't comment then error message shows up.
string filePath = Request.QueryString["FILEPATH"];
Response.ContentType = "image/jpg";
Response.BinaryWrite(System.IO.File.ReadAllBytes(filePath));
Thanks
|
|
|
|
|
Try using a mime type that actually exists: "image/jpeg".
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
i have a grid view on which i m doing insert ,delete,edit operations.
i have created stored procedures for them in sql server 2005.
i created buttons for edit and delete in each row of gridview.
i am only using "rowcommand" event for editing and deleting operation.
on edit button click i want to insert cell values of row into textboxes in my webform outside gridview.
i have edit button outside on clicking which it enters textbox value in grid view..
HOW CAN I ACHIEVE THIS?
source code:-
@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="gvEmployee" DataKeyNames="PKemployeeID" runat="server" Style="z-index: 100;
left: 112px; position: absolute; top: 271px" Width="472px" OnSelectedIndexChanged="gvEmployee_SelectedIndexChanged" Height="46px" AutoGenerateColumns="False" OnRowCommand="gvEmployee_RowCommand">
<Columns>
<asp:BoundField DataField="FirstName" HeaderText="Fitst Name" />
<asp:BoundField DataField="LastName" HeaderText="Last Name" />
<asp:BoundField DataField="EmployeeID" HeaderText="Employee Id" />
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:LinkButton ID="Button1" runat="server" CausesValidation="false" CommandName="EDIT" CommandArgument='<%# Bind("PKemployeeID") %>'
Text="Edit" />
</ItemTemplate>
</asp:TemplateField>
<asp:ButtonField ButtonType="Button" Text="Delete" CommandName="DELETE" />
</Columns>
</asp:GridView>
</div>
<asp:Label ID="Label1" runat="server" Style="z-index: 101; left: 233px; position: absolute;
top: 36px" Text="First Name "></asp:Label>
<asp:TextBox ID="txtEmpId" runat="server" Style="z-index: 102; left: 353px; position: absolute;
top: 158px"></asp:TextBox>
<asp:TextBox ID="txtFirstName" runat="server" Style="z-index: 103; left: 354px; position: absolute;
top: 35px"></asp:TextBox>
<asp:TextBox ID="txtlastname" runat="server" Style="z-index: 104; left: 354px; position: absolute;
top: 91px"></asp:TextBox>
<asp:Label ID="Label2" runat="server" Style="z-index: 105; left: 232px; position: absolute;
top: 159px" Text="EmployeeID"></asp:Label>
<asp:Label ID="Label3" runat="server" Style="z-index: 106; left: 233px; position: absolute;
top: 94px" Text="Last Name"></asp:Label>
<
<asp:Button ID="btnAdd" runat="server" Style="z-index: 109; left: 259px; position: absolute;
top: 214px" Text="Add" Width="88px" OnClick="btnAdd_Click"
/>
</form>
</body>
</html>
aspx.cs:-
using System;
using System.Data;
using System.Configuration;
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 _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string connectionString = (string)ConfigurationManager.AppSettings["ConnectionString"];
SqlConnection sqlconn = new SqlConnection(connectionString);
SqlCommand sqlCommand = new SqlCommand("GetemployeeDetails",sqlconn);
sqlCommand.CommandType = CommandType.StoredProcedure;
DataSet ds = new DataSet();
SqlDataAdapter ada = new SqlDataAdapter(sqlCommand);
ada.Fill(ds);
gvEmployee.DataSource = ds;
gvEmployee.DataBind();
}
protected void gvEmployee_SelectedIndexChanged(object sender, EventArgs e)
{
int index = gvEmployee.SelectedIndex;
}
protected void btnAdd_Click(object sender, EventArgs e)
{
string connectionString = (string)ConfigurationManager.AppSettings["ConnectionString"];
SqlConnection sqlconn = new SqlConnection(connectionString);
SqlCommand cmd = new SqlCommand("insertemployee", sqlconn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@FirstName", txtFirstName.Text);
cmd.Parameters.AddWithValue("@LastName", txtlastname.Text);
cmd.Parameters.AddWithValue("@EmployeeID", txtEmpId.Text);
cmd.Connection.Open();
cmd.ExecuteNonQuery();
cmd.Connection.Close();
}
protected void gvEmployee_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "EDIT")
{
int intPkId = Convert.ToInt32(e.CommandArgument);
/* i dont know what to put here */
//LinkButton btnEdit = e.CommandSource as LinkButton;
//GridViewRow row = (GridViewRow)((LinkButton)e.CommandSource).NamingContainer;
//int index = Convert.ToInt32(gvEmployee.DataKeys[row.RowIndex].Value);
//txtFirstName.Text = row.Cells[1].Text.ToString();
}
}
}
mihirkul vikram
|
|
|
|
|
...
"Well, we're getting "F"'d at work. WPF, WCF, and WWF... WTF?" --John Simmons
|
|
|
|
|
I would like to align controls within a form so that forms appear within a table. Basically I have a form that needs to show, say:
Label Textbox
Name
Address
The 'textbox' in this case need to be aligned under each other.
The problem with using (within
tags was that the code was not compiling within Visual Studio 2005, since it does not comply with the markup validations.
XHTML 1.0 Transitional
Any more ideas, please?
Jon
|
|
|
|
|
You can use the literals to write non-alpha characters. For example, "& a m p;" (without spaces) renders "&" on a page. That'll pass xhtml validation.
|
|
|
|
|
Thanks for your reply, however, I would like to make sure that the controls are aligned. How is this possible?
Jon
|
|
|
|
|
to align controls use css property.
|
|
|
|
|
I could use it to align text, however, I would like to make sure that they fit within a , and, somehow the tags have rendered the page unreadable.
I tried with a smaller version and it worked, so I must have done some mistake in my actual form.
However when I tried to include controls within a wizard control within tags it doesn't compile. Any workarounds?
<br />
<![CDATA[<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>]]><br />
<br />
<br />
<br />
<html xmlns="http://www.w3.org/1999/xhtml"><br />
<head runat="server"><br />
<title></title><br />
</head><br />
<body><br />
<form id="form1" runat="server"><br />
<div><br />
<br />
<asp:wizard id="Wizard1" runat="server" activestepindex="0" height="132px" xmlns:asp="#unknown"><br />
onfinishbuttonclick="Wizard1_FinishButtonClick" Width="765px"><br />
<wizardsteps><br />
<table><br />
<asp:wizardstep id="step1" runat="server" title="Task details"><br />
</asp:wizardstep></table><br />
Choose<asp:dropdownlist id="DropDownList1" runat="server"><br />
<asp:listitem value="2a">Step 2a</asp:listitem><br />
<asp:listitem value="2b">Step 2b</asp:listitem><br />
</asp:dropdownlist><br />
<br /><br />
<br /><br />
<br />
<asp:wizardstep id="step2a" runat="server" title="Step 2a"><br />
</asp:wizardstep><br />
<asp:wizardstep id="step2b" runat="server" title="Step 2b"><br />
</asp:wizardstep><br />
<br />
</wizardsteps><br />
</asp:wizard><br />
<br />
</div><br />
</form><br />
</body><br />
</html><br />
<br />
Error:
Error 1 System.Web.UI.WebControls.WizardStepCollection must have items of type 'System.Web.UI.WebControls.WizardStepBase'. 'table' is of type 'System.Web.UI.HtmlControls.HtmlTable'. c:\inetpub\wwwroot\WebSite2\Default.aspx 16
Jon
modified on Sunday, January 18, 2009 2:36 PM
|
|
|
|
|
hi to all
my problem is that i have two dropdownlist on a web page both are databind first one is for CountryList and Second One is for Country Related Place list. i am using Ajax control toolkit with Visual Studio 2005 . All these work fine But when i select a Country which has more Places Like 1000 or More then Update Progress bar Stops for some time. when i read about Update pannel on Microsft site then i came to know that update pannel reduce the amount of data which transferred between client and server.
so i want to know that how can i increase data transfer between client and server.
|
|
|
|
|
You might want to take a look at your UI design and maybe come up with a way of further limiting the 'places of interest'. 1000 items is really far too many to put into a drop down list.
|
|
|
|
|
Member 4001596 wrote: so i want to know that how can i increase data transfer between client and server
Rather than increasing data transfer between Client and server try to restrict number of records. More that 1000 in a dropdown list does not make any sense
|
|
|
|
|
i know that. but as my requirement i have a large database which consist two table one is country list and second is Place list. i want as when a country is selected the related places fill in second dropdownlist or list box. there are to total 11000 records in places list. then what i do ?
|
|
|
|
|
hi,
i am having a problem in a SQLquery.
actually i am developing a project in asp.net with C# i. e. "MESSAGE BOARD". in this all the topics are displayed in gridview. but here sorting should be as per the last modified topic as well as if any user has replied more than 10 posts , then these messages should be displayed first.
i mean sticky posts should have highest priority to display first in the gridview as well as last modified topic.
the two tables from which i am accessing datas are:
Table1: "create_topic" :
Table Fields : Description
topic_id# : Topic id
group_id# : Group id
cat_id# : subgroup id/category id
username# : user name
topic_title : title of topic
topic_msg : original message
topic_create_date : date when topic is created
no_of_views : total no. of views
no_of_reply : total no. of replies to this topic
Is_sticky : If more than 10 posts by a single user then it is set to Y else N
Is_closed : ban the reply if satisfied.
Table 2: "reply_topic" :
group_id# : group id
cat_id# : category id
reply_id # :reply id
topic_id # :topic id
Username # :username
reply_msg : reply
rply_date : date when reply
can anyone tell me the query which can fulfill the purpose.
I have tried the query but not successfull:
SELECT a.topic_id, a.group_id, a.cat_id, a.username, a.topic_title, a.topic_msg, a.topic_create_date, a.no_of_views, a.no_of_reply, a.is_sticky,
a.is_closed
FROM create_topic AS a INNER JOIN
reply_topic AS b ON a.group_id = b.group_id AND a.cat_id = b.cat_id AND a.topic_create_date = b.rply_date
ORDER BY b.rply_date, a.topic_create_date
UNION
SELECT topic_id, group_id, cat_id, username, topic_title, topic_msg, topic_create_date, no_of_views, no_of_reply, is_sticky, is_closed
FROM create_topic
ORDER BY is_sticky==Y
what is wrong in it or how can i solve the problem.
also uniqueness should be maintained.
please help me.
|
|
|
|
|
I've not tried it, but something like this should do it:
SELECT a.topic_id, a.group_id, a.cat_id, a.username, a.topic_title, a.topic_msg, a.topic_create_date, a.no_of_views, a.no_of_reply, a.is_sticky,
a.is_closed, case when a.is_sticky = 'Y' then getdate() else coalesce(b.rply_date,a.topic_create_date) end as SortDate
FROM create_topic AS a Outer JOIN
reply_topic AS b ON a.group_id = b.group_id AND a.cat_id = b.cat_id AND a.topic_create_date = b.rply_date
Order by SortDate desc
The idea is, when the topis is sticky then use getdate, else use the reply date (if there is one, else topic create date) and order by sort date desc.
This should give you all the topics , sticky first followed by the most recent replies/postings
As I said, I have not tested it, but it should be somewhere on the lines you need.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Thanks for your reply.As per you said i have tried the query:
"SELECT a.topic_id, a.group_id, a.cat_id, a.username, a.topic_title, a.topic_msg, a.topic_create_date, a.no_of_views, a.no_of_reply, a.is_sticky, a.is_closed,
CASE WHEN a.is_sticky = 'Y' THEN getdate() ELSE COALESCE (b.rply_date, a.topic_create_date) END AS SortDate
FROM create_topic AS a FULL OUTER JOIN
reply_topic AS b ON a.group_id = b.group_id AND a.cat_id = b.cat_id AND a.topic_create_date = b.rply_date
WHERE (a.cat_id = @cat_id)
ORDER BY SortDate DESC"
Although the query is resulting the sticky post to be displayed first and rest others to be displayed next.Only as per the date of creating post sorting is maintained ,but when any body replied then this does not reflect the order. Also when there are more than one sticky posts then as per the last modified (either made post or replied ) sorting should be maintained and even same should be applied for the non sticky posts. This is not actually happening.
What changes should i make ,so that it may give the result what actually i want.
Please help me.
|
|
|
|
|
Just change the case statement to set the SortDate to whatever you like, i.e. last modified or whatever. I have given you the basics, its up to you to do any tweaks.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Hello friends.
I want to show the same grid view in another page from first page.
I use the following code in text box case. it work properly. but for grid view what will I change in following code.
In first page:
I take text box and button.
on button click I write
Server.Transfer("page2.aspx");
<u>In Secong page:</u>
On page_load event
{
if(Page.PreviousPage != null)
{
TextBox txt =(TextBox) Page.PreviousPage.FindControl("txtFirstPage");
if(txt != null)
{
Response.Write("<font color='teal' > " + txt.Text + "</font>"); }
}
thanx
|
|
|
|
|