Click here to Skip to main content
15,892,737 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: How to get the STock ticker from Indian Share market ?? Pin
R. Giskard Reventlov1-Apr-10 20:32
R. Giskard Reventlov1-Apr-10 20:32 
AnswerRe: How to get the STock ticker from Indian Share market ?? Pin
MyDevBank2-Apr-10 0:22
MyDevBank2-Apr-10 0:22 
QuestionASP.Net and Oracle Problem Pin
CrazyCoder261-Apr-10 19:24
CrazyCoder261-Apr-10 19:24 
Questioncode of friends Pin
sweta24081-Apr-10 19:04
sweta24081-Apr-10 19:04 
AnswerRe: code of friends Pin
Muhammad Gouda2-Apr-10 4:52
Muhammad Gouda2-Apr-10 4:52 
QuestionVideo conferencing Pin
jayprakash sir ji1-Apr-10 17:44
professionaljayprakash sir ji1-Apr-10 17:44 
Questionwhen user enter the name of category releted records should be pop up in gridview control using asp with c# Pin
developerit1-Apr-10 10:45
developerit1-Apr-10 10:45 
AnswerRe: when user enter the name of category releted records should be pop up in gridview control using asp with c# Pin
Alaric_1-Apr-10 10:49
professionalAlaric_1-Apr-10 10:49 
Change your TextBox to a DropDownList
Create a StoredProcedure that will return you a listing of Categories from your Category reference table
Transform the raw data into a List of KeyValuePairs with your category DisplayNames and your Database Values,
Set the DataSource of your DropDownList to the List<KeyValuePair<string,string>> where each KeyValuePair represents an individual category,
DropDownList.DataBind();
Trigger a postback on Category Selection,
Send the category down to your Stored Procedure as a parameter,
Pull back data,
perform ORM,
set the DataSource of your GridView to a List of your Business Objects
GridView.DataBind();

Done


Quick and dirty, typed in-line off top of head:
public List<KeyValuePair<string, string>> GetCategories()
{
     //Pseudo-Code
     //Open Database Connection
     //Create a command of type StoredProcedure
     //Tell the command which stored procedure to execute (preferrably, your "GetCategories() SP)
     List<KeyValuePair<string,string>> categories = new List<KeyValuePair<string,string>>();
     while(reader.Read())
     {
           categories.Add(new KeyValuePair<string,string>(reader["CategoryName"],reader["categoryID"].ToString());
     }
 return categories;
}

public List<BusinessObject> GetData(int category)
{
     //Pseudo-Code
     //Open Database Connection
     //Create a command of type StoredProcedure
     //Tell the command which stored proc to execute (preferrably, the one that "Gets Data")
     //Send category down to Stored Proc as a parameter
     List<BusinessObject> list = new List<BusinessObject>();
     while(reader.Read())
     {
          list.Add(new BusinessObject(reader["id"],reader["blahdeblah"],reader["whateverotherfieldyouwanttomap"]);
     }
     return list;
}


protected void Page_Load(object sender, EventArgs e)
{
   if(!Page.IsPostBack)
   {
      grdData.DataSource = GetData();
      grdData.DataBind();
      ddlCategories.DataSource = GetCategories();
      ddlCategories.DataTextField = "Key";
      ddlCategories.DataValueField = "Value";
      ddlCategories.DataBind();
   }
}

"I need build Skynet. Plz send code"

Questionhow to calculate total in a gridview dynamically Pin
developerit1-Apr-10 10:39
developerit1-Apr-10 10:39 
AnswerRe: how to calculate total in a gridview dynamically Pin
Alaric_1-Apr-10 10:44
professionalAlaric_1-Apr-10 10:44 
Questionhow to transfer data from one page gridview to anothe page gridview Pin
developerit1-Apr-10 10:37
developerit1-Apr-10 10:37 
AnswerRe: how to transfer data from one page gridview to anothe page gridview Pin
Alaric_1-Apr-10 10:43
professionalAlaric_1-Apr-10 10:43 
AnswerRe: how to transfer data from one page gridview to anothe page gridview Pin
jayprakash sir ji1-Apr-10 17:47
professionaljayprakash sir ji1-Apr-10 17:47 
QuestionProblem: Quirky Problem with Javascript OnClick chaining - Server code executed | Client code ignored (C# 3.5) Pin
Alaric_1-Apr-10 10:32
professionalAlaric_1-Apr-10 10:32 
QuestionMessage Removed Pin
1-Apr-10 8:20
hi_everybody1-Apr-10 8:20 
AnswerRe: want to clear oops concepts in depth Pin
Not Active1-Apr-10 8:26
mentorNot Active1-Apr-10 8:26 
AnswerRe: want to clear oops concepts in depth Pin
Alaric_1-Apr-10 11:13
professionalAlaric_1-Apr-10 11:13 
AnswerRe: want to clear oops concepts in depth Pin
Muhammad Gouda2-Apr-10 4:59
Muhammad Gouda2-Apr-10 4:59 
QuestionDetect an external email address Pin
Dayekh1-Apr-10 5:01
Dayekh1-Apr-10 5:01 
AnswerRe: Detect an external email address Pin
JHizzle1-Apr-10 5:07
JHizzle1-Apr-10 5:07 
GeneralRe: Detect an external email address Pin
Dayekh1-Apr-10 5:16
Dayekh1-Apr-10 5:16 
GeneralRe: Detect an external email address Pin
JHizzle1-Apr-10 5:24
JHizzle1-Apr-10 5:24 
GeneralRe: Detect an external email address Pin
Dayekh1-Apr-10 5:54
Dayekh1-Apr-10 5:54 
Questioncross platform feature of asp.net Pin
ships_agr1-Apr-10 3:43
ships_agr1-Apr-10 3:43 
AnswerRe: cross platform feature of asp.net Pin
JHizzle1-Apr-10 4:04
JHizzle1-Apr-10 4:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.