Click here to Skip to main content
15,923,197 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Vb.net AND C# Pin
Christian Graus9-Dec-07 16:19
protectorChristian Graus9-Dec-07 16:19 
Questionset login user control to my site from a data base Pin
Knowledgestudent9-Dec-07 15:46
Knowledgestudent9-Dec-07 15:46 
GeneralRe: set login user control to my site from a data base Pin
Christian Graus9-Dec-07 16:16
protectorChristian Graus9-Dec-07 16:16 
GeneralRe: set login user control to my site from a data base Pin
Knowledgestudent9-Dec-07 16:46
Knowledgestudent9-Dec-07 16:46 
QuestionHow to save filename in korea language while exporting gridview to ecxel. Pin
Rajesh_K_Sharma9-Dec-07 13:56
Rajesh_K_Sharma9-Dec-07 13:56 
GeneralGridView on MultiView / View with MenuItems to change Views - the problem Pin
Member 47002259-Dec-07 12:28
Member 47002259-Dec-07 12:28 
GeneralRe: GridView on MultiView / View with MenuItems to change Views - the problem Pin
Michael Sync9-Dec-07 15:15
Michael Sync9-Dec-07 15:15 
AnswerRe: GridView on MultiView / View with MenuItems to change Views - the problem Pin
Member 47002259-Dec-07 18:33
Member 47002259-Dec-07 18:33 
Hi Michael,

Here's what I'm doing: for the common part of the page, I am using dataset to populate some textbox controls, then for the details part - I'm using GridViews with a SqlDataSources. Each of the GridViews are placed on a View control being changed by MenuItem clicks. Here are some code:
protected void Page_Init(object sender, EventArgs e)
{
projectId = Convert.ToInt32(Session["ClickedId"]);
string [] dataKeys = {"MethodSID"};
conn = new SqlConnection();
// Get the ConnectionString dynamically
conn.ConnectionString = ConfigurationManager.ConnectionStrings["EEM-NEWConnectionString1"].ConnectionString;
dsrcMethods.ConnectionString = conn.ConnectionString;
Parameter param;
dsrcMethods.UpdateCommand = "update tblMethod set MethodName=@MethodName, MethodDesc=@MethodDesc,"
+ "TaxonomicalKeys=@TaxonomicalKeys, TaxonomicalDesc=@TaxonomicalDesc"
+ " where MethodSID=@MethodSID and ProjectID=" + projectId;
dsrcMethods.InsertCommand = "insert into tblMethod (ProjectID, MethodName, MethodDesc, TaxonomicalKeys,"
+ " TaxonomicalDesc) values (" + projectId + ",@MethodName,@MethodDesc,"
+ " @TaxonomicalKeys,@TaxonomicalDesc)";
param = new Parameter("MethodSID", TypeCode.Int32);
dsrcMethods.UpdateParameters.Add(param);
param = new Parameter("MethodName", TypeCode.String);
dsrcMethods.UpdateParameters.Add(param);
dsrcMethods.InsertParameters.Add(param);
param = new Parameter("MethodDesc", TypeCode.String);
dsrcMethods.UpdateParameters.Add(param);
dsrcMethods.InsertParameters.Add(param);
param = new Parameter("TaxonomicalKeys", TypeCode.String);
dsrcMethods.UpdateParameters.Add(param);
dsrcMethods.InsertParameters.Add(param);
param = new Parameter("TaxonomicalDesc", TypeCode.String);
dsrcMethods.UpdateParameters.Add(param);
dsrcMethods.InsertParameters.Add(param);
gvMethods.DataKeyNames = dataKeys;
gvMethods.DataSourceID = dsrcMethods.ID;
}
protected void Page_Load(object sender, EventArgs e)
{
txtID.Focus();
txtID.Enabled = false;
txtTitle.Enabled = false;
txtAbstract.Enabled = false;
txtJust.Enabled = false;
txtSponsor.Enabled = false;
txtStartDate.Enabled = false;
txtStatus.Enabled = false;
txtEndDate.Enabled = false;
txtProgress.Enabled = false;
txtAck.Enabled = false;
if (!Page.IsPostBack)
{
conn.Open();
try
{
txtID.Text = projectId.ToString();
// Create SqlCommand and Parameter to select ProjectID
cmd = new SqlCommand("Select * from tblProject where ProjectSID=@ProjectID", conn);
cmd.Parameters.Add("@ProjectID", SqlDbType.Int);
cmd.Parameters["@ProjectID"].Value = projectId;

dsProject = new DataSet();
da = new SqlDataAdapter(cmd);
da.Fill(dsProject);
cmd.ExecuteReader();
// If there are no records for the user
if (dsProject.Tables[0].Rows.Count == 0)
{
lbl = new Label();
lbl.Text = "<p>You do not have any data for this Project</p>";
Controls.Add(lbl);
}
else
{
txtTitle.Text = dsProject.Tables[0].Rows[0].ItemArray[1].ToString();
txtAbstract.Text = dsProject.Tables[0].Rows[0].ItemArray[2].ToString();
txtJust.Text = dsProject.Tables[0].Rows[0].ItemArray[3].ToString();
txtSponsor.Text = dsProject.Tables[0].Rows[0].ItemArray[4].ToString();
txtStartDate.Text = dsProject.Tables[0].Rows[0].ItemArray[5].ToString();
txtStatus.Text = dsProject.Tables[0].Rows[0].ItemArray[6].ToString();
if (dsProject.Tables[0].Rows[0].ItemArray[7].ToString() == null ||
dsProject.Tables[0].Rows[0].ItemArray[7].ToString() == "")
txtEndDate.Text = "Not Applicable";
else
txtEndDate.Text = dsProject.Tables[0].Rows[0].ItemArray[7].ToString();
txtProgress.Text = dsProject.Tables[0].Rows[0].ItemArray[8].ToString();
txtAck.Text = dsProject.Tables[0].Rows[0].ItemArray[9].ToString();
}
// Cleanup command and connection objects.
dsProject.Dispose();
da.Dispose();
cmd.Dispose();
conn.Close();
}
catch (Exception ex)
{
// Add error handling here for debugging.
Response.Write(ex.Message);
//System.Diagnostics.Trace.WriteLine("[ValidateUser] Exception " + ex.Message);
}
}
}
protected void mnuProjectDetails_MenuItemClick(Object sender, MenuEventArgs e)
{
gvMethods.Focus();

// Get the MenuItem Clicked
int item = Int32.Parse(e.Item.Value);

if (item == 0)
{
conn.Open();
dsrcMethods.SelectCommand = "select * from tblMethod where ProjectID=" + projectId;
conn.Close();
}
else if (item == 1)
{
conn.Open();
dsrcTools.ConnectionString = conn.ConnectionString;
dsrcTools.SelectCommand = "select * from tblTool t, tblMethod m where m.MethodSID=t.MethodID and"
+ " m.ProjectID=" + projectId;
gvTools.DataSourceID = dsrcTools.ID;
conn.Close();
}
MultiView1.ActiveViewIndex = Int32.Parse(e.Item.Value);
}

Thanks for taking your time and I'm positive that you can find something for me.
GeneralRe: GridView on MultiView / View with MenuItems to change Views - the problem Pin
Michael Sync9-Dec-07 19:06
Michael Sync9-Dec-07 19:06 
QuestionNavigation?? Pin
Muammar©9-Dec-07 7:54
Muammar©9-Dec-07 7:54 
AnswerRe: Navigation?? Pin
Christian Graus9-Dec-07 9:25
protectorChristian Graus9-Dec-07 9:25 
AnswerRe: Navigation?? Pin
Paul Conrad9-Dec-07 12:45
professionalPaul Conrad9-Dec-07 12:45 
GeneralProblem in Validation Control Pin
Parameswar Mal9-Dec-07 2:16
Parameswar Mal9-Dec-07 2:16 
GeneralRe: Problem in Validation Control Pin
Michael Sync9-Dec-07 2:49
Michael Sync9-Dec-07 2:49 
Generalhi why we use DIV Pin
wasimsharp9-Dec-07 2:16
wasimsharp9-Dec-07 2:16 
GeneralRe: hi why we use DIV Pin
Sathesh Sakthivel9-Dec-07 4:55
Sathesh Sakthivel9-Dec-07 4:55 
GeneralRe: hi why we use DIV Pin
Christian Graus9-Dec-07 9:25
protectorChristian Graus9-Dec-07 9:25 
GeneralServer Unavailable Pin
Muammar©8-Dec-07 10:17
Muammar©8-Dec-07 10:17 
GeneralRe: Server Unavailable Pin
Christian Graus8-Dec-07 12:33
protectorChristian Graus8-Dec-07 12:33 
GeneralRe: Server Unavailable Pin
Muammar©8-Dec-07 19:14
Muammar©8-Dec-07 19:14 
GeneralRe: Server Unavailable Pin
Christian Graus8-Dec-07 21:37
protectorChristian Graus8-Dec-07 21:37 
GeneralRe: Server Unavailable Pin
Gamzun8-Dec-07 22:39
Gamzun8-Dec-07 22:39 
GeneralYES!! IT'S WORKING:) Pin
Muammar©8-Dec-07 23:36
Muammar©8-Dec-07 23:36 
GeneralRe: YES!! IT'S WORKING:) Pin
Gamzun8-Dec-07 23:37
Gamzun8-Dec-07 23:37 
QuestionGridView on MultiView / Views with MenuItems to change Views - having problems Pin
Member 47002258-Dec-07 7:07
Member 47002258-Dec-07 7:07 

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.