|
|
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.
|
|
|
|
|
I have an asp:menu with a css background-image on the StaticMenuItemStyle-CssClass. But, the background around the text label itself isn't opaque, so there's a solid blue box around the text that you can clearly see over the background image (see my screenshot). How do I make the text label background transparent?
|
|
|
|
|
Next time please write this post on the CSS forum,
anyway,
add a css class to your text labels to something like:
.textlabel
{
border: none;
background: none;
}
gOOd lUCk
|
|
|
|
|
Thanks for your help, but how was I supposed to know if the solution would come as CSS or an ASP:Menu property? :P
Thanks
|
|
|
|
|
Christopher Hill wrote: I have an asp:menu with a css background-image on the StaticMenuItemStyle-CssClass.
. . . in your original question.
|
|
|
|
|
Hi in sql, "identity column" will automatically increase the value of its own, wenever other columns getting the value.
But in my case i have mentioned my column datatype as varchar, so "identity" wont work out here.
i want to insert my datas like this format for my ID Column,
ID
V00000001
V00000002
V00000003
.
.
.
V00000023
how to achieve using asp.net
Thanks & Regards,
Member 3879881,
please don't forget to vote on the post
|
|
|
|
|
If the data always begins with "V" I would use the idendity column and concatenate either in a calculated column or in my data/business layer to form the field.
Otherwise, add an insert trigger to the table and use string functions to convert to a number, find the next in the sequence, then insert the column.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Before inserting, get the max Id number from your database, increment it by 1 (or your wish) and then insert a new record in the table using an incremented Id.
You gona have to do some logic for the correct number of zeros to be put before the actuall number.
|
|
|
|
|
For that, you have to do the following.....
1) First retrieve the max id from your database.
2) Then convert the number part of data i.e. 00000001 to int.
3) Then increment it.
4) According to the number, concatenate that number of 0's and V to the incremented number.
5) Insert this id to your database.
6) Enjoy!
|
|
|
|
|
I am using visial studio 2010.
And i want to make download link.
so i made by using href tag.
for example) temp
for example) temp
xls show me download windows, but jpg file was opened by browser.
How can i download link about all files?
hi
My english is a little.
anyway, nice to meet you~~
and give me your advice anytime~
|
|
|
|