|
codeprojectforums.com Currently under Testing
-- Modified Thursday, August 11, 2011 7:37 AM
|
|
|
|
|
how to do a comment box to comment for our photos like in facebook comments in asp.
|
|
|
|
|
Use a textbox?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Otherwise textarea if that doesn't do?
Or maybe a Repeater? with necessary asp.net controls e.g. divs, inputs -> text, button, submits
...and the like.
With a repeater, you can bind it with new comments stored somewhere maybe from the database.
|
|
|
|
|
Morgs Morgan wrote: Otherwise textarea if that doesn't do
Umm, a multiline textbox renders as an html textarea.
And, wouldn't it better to respond to the OP?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
hi i have used listview to show the previously posted comments but the problem arises when a user tries to update or delete comments
i.e the user should be able to update/delete only his comments and not other user comment
( p.s i have used a login page to store the name of users in database so after logging in he shld be editing his comments only)
When the student is ready, the master appears.
|
|
|
|
|
So you have have an authenticated user and the posts are associated with a valid user. So what is the problem? Are you saying with all of this information you can't find a way to disable an edit or delete button/link?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
table data is
col1 col2 col3 col4
----------------------
1 1a 1b 1c
1 1a 1d 1e
1 1b 1f 1g
2 2a 2b 2c
2 2a 2d 2e
2 2b 2f 2g
2 2b 2h 2i
2 2b 2j 2k
Need to format output as
col1 col2 col3 col4
----------------------
1 1a 1b 1c
1d 1e
1b 1f 1g
2 2a 2b 2c
2d 2e
2b 2f 2g
2h 2i
2j 2k
i.e hiding repeating data.
I am thinking creating a data table object then check for repeating data column,
if repeat then add blank column,
else add same column.
Is there any other way of achieving this ?
what if table contain 10000 rows ?
Any logic/help/link/post will be much helpful.
regards
|
|
|
|
|
|
|
hi,
You can use a List collection to store the data whilst reading from the db.
i don't know where you are getting the data from or how so i will assume its from the database and u are using TSQL
SqlDataReader = reader.ExecuteQuery ( commandText ) ;
ArrayList aList = new ArrayList ( ) ;
while ( reader.Read ( ))
{
if ( ! aList.Contains ( ( string )reader[ "rowname" ] ) )
{
}
}
Good luck
|
|
|
|
|
How can i test .aspx pages through VSTS Unit testing?
|
|
|
|
|
RTFM
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
Please snd source codz of RTFM program.
|
|
|
|
|
|
Worryingly, you seem to have failed to do basic research in the intervening 20ish hours since you posted version 1 of your question. Your lack of research skills may be urgent to you, but it isn't to the unpaid volunteers who comprise the members here. Read the FAQs: Do not bump your question by reposting.
|
|
|
|
|
I have taken Web User Control 3 times on Same pAge ..?
control is Rendered For 3 instances But Events For control is not get Fired...?
Events Works Fine For One control ......
But if I add More Than one Controls then IT is Not Working...........?
Thanks in Advance
|
|
|
|
|
Are you the author of the User Control? If yes, then show us some code which will help us to understand your problem. If it is not your control, then you must contact its author for a solution.
|
|
|
|
|
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public delegate void SendDataFromSearchControl(int iSelectedCustId);
public partial class SearchControl : System.Web.UI.UserControl
{
#region members
public event SendDataFromSearchControl Event_Selected;
string cmdSearchCustomer;
string select_what, select_from_database, search_text, search_listbox_value_field,condition_name,matching_condition;
bool flaglstbox = false;
#endregion
#region Properties
public string SELECT_WHAT
{
get
{
return ViewState["select_what"].ToString();
}
set
{
ViewState["select_what"] = value;
}
}
public string SELECT_FROM_DATABASE
{
get
{
return ViewState["select_from_database"].ToString();
}
set
{
ViewState["select_from_database"] = value;
}
}
public string SEARCH_TEXT
{
get
{
return ViewState["search_text"].ToString();
}
set
{
ViewState["search_text"] = value;
}
}
public string SEARCH_LISTBOX_VALUE_FIELD
{
get
{
return ViewState["search_listbox_value_field"].ToString();
}
set
{
ViewState["search_listbox_value_field"] = value;
}
}
public string Condition_Name
{
get
{
return ViewState["Condition_Name"].ToString();
}
set
{
ViewState["Condition_Name"] = value;
}
}
public string Matching_Condition
{
get
{
return ViewState["Matching_Condition"].ToString();
}
set
{
ViewState["Matching_Condition"] = value;
}
}
#endregion
protected void Page_Load(object sender, EventArgs e)
{
select_what = SELECT_WHAT;
select_from_database = SELECT_FROM_DATABASE;
search_text = SEARCH_TEXT;
search_listbox_value_field = SEARCH_LISTBOX_VALUE_FIELD;
condition_name = Condition_Name;
matching_condition = Matching_Condition;
}
#region Events
protected void lstcust_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void btnsearch_Click(object sender, EventArgs e)
{
if (txrsearch.Text == "")
{
// cmdSearchCustomer = "select " + search_listbox_value_field + " ," + select_what + " from " + select_from_database + " ORDER BY " + select_what + " ASC And "+condition_name+"="+matching_condition+"";
cmdSearchCustomer = "select " + search_listbox_value_field + " ," + select_what + " from " + select_from_database + " Where " + condition_name + "='"+matching_condition+"' ORDER BY " + select_what + " ASC";
}
else
{
cmdSearchCustomer = "select " + search_listbox_value_field + " ," + select_what + " from " + select_from_database + " where " + search_text + " like '" + txrsearch.Text + "%' And "+condition_name+"='"+matching_condition+"' ORDER BY " + select_what + " ASC";
}
DataSet ds = MIS_DAL.Fill(cmdSearchCustomer);
if (ds.Tables[0].Rows.Count > 0)
{
lstcust.Items.Clear();
lstcust.AppendDataBoundItems = true;
lstcust.DataSource = ds.Tables[0];
lstcust.DataTextField = select_what;
lstcust.DataValueField = search_listbox_value_field;
lstcust.DataBind();
}
else
{
Alert.Show("No Customer Found");
}
}
protected void txrsearch_TextChanged(object sender, EventArgs e)
{
}
protected void btnreturn_Click(object sender, EventArgs e)
{
}
protected void lstcust_SelectedIndexChanged1(object sender, EventArgs e)
{
Session["flaglstbox"] =(bool) true;
}
protected void btnselect_Click1(object sender, EventArgs e)
{
if ((bool)Session["flaglstbox"] == true)
{
if (Event_Selected != null)
{
this.Event_Selected(int.Parse(lstcust.SelectedItem.Value));
// Event_Selected(int.Parse(lstcust.SelectedItem.Value));
}
lstcust.Items.Clear();
txrsearch.Text = "";
}
else
{
}
}
protected void btncancel_Click(object sender, EventArgs e)
{
lstcust.Items.Clear();
txrsearch.Text = "";
}
#endregion
}
|
|
|
|
|
What is your problem? Do you get any errors or is it just that the control doesn't work as expected?
|
|
|
|
|
If you are going to post code then follow the posting guideleines and FORMAT it properly!
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
select_what = SELECT_WHAT;
select_from_database = SELECT_FROM_DATABASE;
search_text = SEARCH_TEXT;
search_listbox_value_field = SEARCH_LISTBOX_VALUE_FIELD;
condition_name = Condition_Name;
matching_condition = Matching_Condition;
So you are assiging your private variables from ViewState each time the page is loaded? Why? Are the values set on the page anywhere? They will always be empty strings if not. If they are preset values there is no reason to use ViewState to store them. Do you understand what ViewState is any how to use it?
cmdSearchCustomer = "select " + search_listbox_value_field + " ," + select_what + " from " + select_from_database + " where " + search_text + " like '" + txrsearch.Text + "%' And "+condition_name+"='"+matching_condition+"' ORDER BY " + select_what + " ASC";
Concatentating strings to form a SQL statement with unvalidated user input? WTF!?! Every heard of a SQL Injection Attack? Every heard of a parameterized query?
Each instance of the control placed on the page is sharing the smae ViewState and Session variables. If there can be multiple instances of the same control you need to take that in to account.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Mark Nischalke wrote: Each instance of the control placed on the page is sharing the smae same ViewState and Session variables.
That is his problem exactly. I was waiting for him to turn up, but he didn't.
|
|
|
|
|
hi
i need to test the UI page which has two radio buttons. According to the selection of radio button by users functions will be called and those function uses 5 class files and in turn 5 methods.
now i need to APPLY UNIT Test on above said functionality, how can i achieve this?
what are the steps i need to start with.
|
|
|
|
|
Your classes should be designed in such a way that they can be unit tested without the actual involvement of UI elements. For example, in your case, a method should take an argument that is a flag to indicate which radio button was clicked. You can then apply text fixtures to this method and call it with different arguments to simulate selection of different radio buttons. To put it in another way, your code should not contain hard-coded logic that works differently for different selections of UI elements. It you write code that way, it is very difficult to unit test them.
|
|
|
|