|
Find out the dropdown in the header row of the grid view and filter the dataview based on the selected value of the dropdown
|
|
|
|
|
I have a doubt.
i have 10 check boxes.i want to check first three check boxes and applying color to the selected check boxes.
how can i apply color to the selected check boxes ?how to store and retrieve the check box value and color to the database?
Pls help me....
|
|
|
|
|
Take the color in the form of string format and change it into color format..!
You mean to say caonverting text to color i think
if yes follow the below code
System.Drawing.ColorConverter colConvert = new ColorConverter();
lblSample.BackColor = (System.Drawing.Color)colConvert.ConvertFromString("Your Color");
If No
please eloborate..!
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
I'm not sure if I understand the question right, but based on what I understand, you wish to set the back color for checkboxes that are checked to say "Blue" and the unchecked check boxes are to be left as is. You also wish to persist the details on which check boxes are checked and which are not and if and when needed want to recreate the checkboxes with the same status. Am I correct?
If yes, then
1. To set the color of checkboxes - set the back color of the check box oncheckedchange event. Wire-up all the checkboxes to the same event and use the event source to identify the checkbox
2. To persist the state - there are many way how you can save the state, if the no of checkboxes is a constant and less than 5 you can have individual binary columns in db and save the status directly. If otherwise, I prefer form a Binary string of 1s and 0s representing the state of the checkboxes and then convert it to integer and would store it in the DB. When it is time to re-create the checkboxes, retrieve the int value, convert it to binary and use it to set the status. Remember to persist the number of checkboxes along with the status integer. This is just my way and there may be many different and efficient ways to do the same.
HTH!
|
|
|
|
|
i developed a Windows apllication (Payroll). Intially i created External database.But i have to install in systems. Now im creating in built database already queries are executed. After closing the closing the application the data is not saving
Wt is the problem.
i tried so many times.
Please help me out in this situation
Thanks in Advance,
KS
This is the code
con = new SqlConnection();
con.ConnectionString = ConfigurationManager.ConnectionStrings["con"].ToString();
cmd = new SqlCommand("insert into TDept values('" + TXT_TDName.Text + "')", con);
//cmd.CommandText = q;
//cmd.CommandType = CommandType.Text;
//cmd.Parameters.AddWithValue("@TDName", TXT_TDName.Text);
con.Open();
int r = (int)cmd.ExecuteNonQuery();
|
|
|
|
|
kalyansantosh wrote: i developed a Windows apllication (Payroll)
This is ASP.NET Forum.
kalyansantosh wrote: After closing the closing the application the data is not saving
I didn't get your point.
kalyansantosh wrote: con = new SqlConnection();
con.ConnectionString = ConfigurationManager.ConnectionStrings["con"].ToString();
cmd = new SqlCommand("insert into TDept values('" + TXT_TDName.Text + "')", con);
//cmd.CommandText = q;
//cmd.CommandType = CommandType.Text;
//cmd.Parameters.AddWithValue("@TDName", TXT_TDName.Text);
con.Open();
int r = (int)cmd.ExecuteNonQuery();
Quote Selected Text
Did you tried to debug your code by putting breakpoint ? What is vlaue of cmd after execution of that line ?
cmd = new SqlCommand("insert into TDept values('" + TXT_TDName.Text + "')", con);
Why you are opening Connection after initilizing the Cmd ?
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Is it anybody know why I can only see just trace for some of my asp.net pages in trace.axd?
|
|
|
|
|
Trace of the accessed(opened) .net pages of an application only will be found in trace.axd
|
|
|
|
|
Hi guyzz.. Im developing a web application here i get datas from the user and on a button click these datas get stored in my data base now i have another button on clicking it,it retrieves all the data from the database and gets saved in my system as an XML file... the code is as follows for the button that creates an xml file...
private void Button1_Click(object sender, System.EventArgs e)
{
SqlDataAdapter da = null;
try
{
con = new SqlConnection();
con.ConnectionString = ConfigurationSettings.AppSettings["DSN"];
da = new SqlDataAdapter("select * from card_details",con);
DataSet ds = new DataSet();
da.Fill(ds,"card_details");
ds.WriteXml("D:\ADIB\OutputXML.xml");
}
catch(SqlException ex)
{
throw new System.Exception ("Error -- " +ex.Message);
}
catch(Exception exp)
{
throw new System.Exception ("Error -- " +exp.Message);
}
finally
{
con.Close();
da.Dispose();
}
}
Now my issue is i need my application to create the xml file,before saving it into my system it should ask me whether to open the file or save the file so that i can specify the file name (something similar to a download window in our web browser)... please advice me...
Thanx in advance..
Regards,
Tash
|
|
|
|
|
Maybe use something like SaveFileDialog[^]
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Im using VS2003 framework1.1
Any other ideas or any other ways do please let me know....
Thanx in advance
Regards,
Tash
modified on Wednesday, February 3, 2010 11:05 PM
|
|
|
|
|
Sorry it dint work.. Im using VS2003... plz advice me...
Thanx in advance..
Regards,
Tash
|
|
|
|
|
Any ideas or any ways do please let me know......
Regards,
Tash
|
|
|
|
|
use below code
private void button1_Click(object sender, EventArgs e)
{
saveFileDialog1.FileOk += new CancelEventHandler(saveFileDialog1_FileOk);
saveFileDialog1.ShowDialog(this);
}
void saveFileDialog1_FileOk(object sender, CancelEventArgs e)
{
SaveFileDialog ss = sender as SaveFileDialog;
SqlDataAdapter da = null;
try
{
con = new SqlConnection();
con.ConnectionString = ConfigurationSettings.AppSettings["DSN"];
da = new SqlDataAdapter("select * from card_details", con);
DataSet ds = new DataSet(); da.Fill(ds, "card_details");
ds.WriteXml(ss.FileName);
}
catch (SqlException ex)
{
throw new System.Exception("Error -- " + ex.Message);
}
catch (Exception exp)
{
throw new System.Exception("Error -- " + exp.Message);
}
finally
{
con.Close(); da.Dispose();
}
}
saveFileDialog1 is SaveFileDialog type win control.
|
|
|
|
|
Hi thanx for ur reply... My problem is not solved yet... as u said when i type saveFileDialog1. i dont find "FileOk"... i dont know why... may be its because im using VS2003??? plz help me...
Thanx in advance...
Regards,\
Tash
|
|
|
|
|
Following code should solve your problem:
Response.Clear();
Response.ContentType = "text/plain";
Response.WriteFile("D:\\ADIB\\OutputXML.xml");
Response.Flush();
|
|
|
|
|
I wrote my code in VS 2008. Under dialog section of toolbox you can get the specified control.
TRY this Code
System.Windows.Forms.SaveFileDialog saveFileDialog = new System.Windows.Forms.SaveFileDialog();
saveFileDialog.Filter = "XML Files (*.xml)|*.*";
if (saveFileDialog.ShowDialog(this) == DialogResult.OK)
{
string FileName = saveFileDialog.FileName;
if (FileName.Trim() != "")
{
}
}
|
|
|
|
|
I did as u said.. but got an error in this line --->
if (saveFileDialog.ShowDialog(this) == DialogResult.OK)
The error stated was --->
<br />
The best overloaded method match for 'System.Windows.Forms.CommonDialog.ShowDialog(System.Windows.Forms.IWin32Window)' has some invalid arguments<br />
Thanx in advance...
Regards,
Tash
|
|
|
|
|
try this
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
|
|
|
|
Hi.. now ther was no build errors but after execution.. when i click my button to create Xml file i receive the following exception --->
<br />
It is invalid to show a modal dialog or form when the application is not running in UserInteractive mode. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.<br />
And the line in which this exception ocuurs -->>
if (saveFileDialog.ShowDialog() == DialogResult.OK)
thanx in advance..
Regards,
Tash
|
|
|
|
|
I think you are not use win form application . Is that true if it is then you can't do it using previous procedure.Please use a Custom pop up to do this.
|
|
|
|
|
Ohh no.. so what am i supposed 2 do??? any idea???
regards,
tash
|
|
|
|
|
This will help you much , I think it works fine
Response.ContentType = "text/xml";
Response.AppendHeader("Content-Disposition", "attachment; filename=mmm.xml");
Response.TransmitFile(Server.MapPath("~/images/mmm.jpg"));
SqlDataAdapter da = null;
try
{
con = new SqlConnection();
con.ConnectionString = ConfigurationSettings.AppSettings["DSN"];
da = new SqlDataAdapter("select * from card_details", con);
DataSet ds = new DataSet(); da.Fill(ds, "card_details");
ds.WriteXml(Response.OutputStream);
Response.End();
}
catch (SqlException ex)
{
throw new System.Exception("Error -- " + ex.Message);
}
catch (Exception exp)
{
throw new System.Exception("Error -- " + exp.Message);
}
finally
{
con.Close(); da.Dispose();
}
modified on Thursday, February 4, 2010 6:01 AM
|
|
|
|
|
Try this i think it will help you;
Response.ContentType = "text/xml"; <br />
Response.AppendHeader("Content-Disposition", "attachment; filename=mmm.xml");<br />
Response.TransmitFile(Server.MapPath("~/images/sailbig.jpg"));<br />
SqlDataAdapter da = null;<br />
try<br />
{<br />
con = new SqlConnection();<br />
con.ConnectionString = ConfigurationSettings.AppSettings["DSN"];<br />
da = new SqlDataAdapter("select * from card_details", con);<br />
DataSet ds = new DataSet(); da.Fill(ds, "card_details");<br />
ds.WriteXml(Response.OutputStream);<br />
Response.End();<br />
}<br />
catch (SqlException ex)<br />
{<br />
throw new System.Exception("Error -- " + ex.Message);<br />
}<br />
catch (Exception exp)<br />
{<br />
throw new System.Exception("Error -- " + exp.Message);<br />
}<br />
finally<br />
{<br />
con.Close(); da.Dispose();<br />
}<br />
<br />
}
|
|
|
|
|
use ...
Response.ContentType = "text/xml";
Response.AppendHeader("Content-Disposition", "attachment; filename=mmm.xml");
Response.TransmitFile(Server.MapPath("~/images/mmm.jpg"));
SqlDataAdapter da = null;
try
{
con = new SqlConnection();
con.ConnectionString = ConfigurationSettings.AppSettings["DSN"];
da = new SqlDataAdapter("select * from card_details", con);
DataSet ds = new DataSet(); da.Fill(ds, "card_details");
ds.WriteXml(Response.OutputStream);
Response.End();
}
catch (SqlException ex)
{
throw new System.Exception("Error -- " + ex.Message);
}
catch (Exception exp)
{
throw new System.Exception("Error -- " + exp.Message);
}
finally
{
con.Close(); da.Dispose();
}
|
|
|
|