|
Hi there,
I want to add dynamically checkboxes to the datagridview rows which displays data on textchange event of a textbox using LIKE query.
On clicking checkboxes I want to go for further coding.
Please help.
|
|
|
|
|
|
Hi,
That question was raised by me itself but, I couldn't find right answer.
One who suggested me at design time instead of runtime.
Please help.
|
|
|
|
|
Does the textbox reside inside the grid view or some where else? Are you trying to say that on the textchanged event of the textbox, checkbox lists should be created with the data that depends upon the textbox's text right.
You can add a Template Column in the gridview. Drag a checkbox list in the ItemTemplate. Set the autpostback to true ande define an event. This event will be common for all checkboxes in your gridview. Now in the RowDataBound event of your gridview, just set the items of the checkbox list depending upon the data that you want to bind. As you have already set the event with the checkbox list, you can do what ever you want in the checkboxlist selected index changed event.
It's a bit long discussion but I hope something is clear now If I took your words right.
Regards
Saanj
Either you love IT or leave IT...
|
|
|
|
|
Sir,
Your first statement was right that I m having textbox outside to that of datagridview.
You gave the code which was in ASP.NET but,I m working on C# Windows.
Even I succeeded in adding checkboxes at runtime on textchange event of external checkbox on your behalf....Thanks.
But, now I m quering about how will I get the appropriated row record on clicking respective checkbox on the row ? Is there any event about databinding events to succeed further?
I want to check it for furher process.
Please help.
awaiting.................
|
|
|
|
|
Hi,
I am sorry but I have very limited experience on Win Forms. But I can refer the following link:
[^][^]
Regards
Saanj
Either you love IT or leave IT...
|
|
|
|
|
You can add a COLUMN of checkboxes, you cannot add a chackbox to a single row. I use the following:
DataGridViewCheckBoxColumn oDGC = new DataGridViewCheckBoxColumn();
oDGC.HeaderText = "Sel";
oDGC.Name = "Sel";
oDGC.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
oDGC.FlatStyle = FlatStyle.Standard;
oDGC.CellTemplate = new DataGridViewCheckBoxCell();
oDGC.CellTemplate.Style.BackColor = System.Drawing.Color.Beige;
oDGC.ThreeState = false;
oDG.Columns.Insert(iCol, oDGC);
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
(i hope i write true place)
Hi all, i use the two method shown below, to sent text as html to a word document, but non english characters arent shown in the document. what can i do??
private void button2_Click(object sender, EventArgs e)
{
WordApp = new Word.ApplicationClass();
fileName = @"........";
Microsoft.Office.Interop.Word.Document aDoc = WordApp.Documents.Open(ref fileName, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref Format, ref missing, ref isVisible, ref missing, ref missing, ref missing, ref missing);
WordApp.Visible = true;
bookmarkPaste (aDoc, bookmarkinWordDoc,myHtmlScript);
}
public void bookmarkPaste(Word.Document aDoc, string bookmarkAdi, string data)
{
try
{
object bookmark = bookmarkAdi;
object missing = System.Reflection.Missing.Value;
object pasteType = Word.WdPasteDataType.wdPasteHTML;
DataObject clipDO = new DataObject();
if (aDoc.Bookmarks.Exists(bookmark.ToString()))
{
Word.Range rangeTbl = aDoc.Bookmarks.get_Item(ref bookmark).Range;
clipDO.SetData(DataFormats.Html,HtmlClipboardData (data));
Clipboard.SetDataObject(clipDO, true);
rangeTbl.PasteSpecial(ref missing, ref missing, ref missing, ref missing, ref pasteType, ref missing, ref missing);
}
else
{
}
}
catch (Exception exc)
{
MessageBox.Show(exc.Message);
}
}
private static string HtmlClipboardData(string html)
{
StringBuilder sb = new StringBuilder();
Encoding encoding = Encoding.UTF8;
string Header = @"
Version: 1.0
StartHTML: {0:000000}
EndHTML: {1:000000}
StartFragment: {2:000000}
EndFragment: {3:000000}
";
string HtmlPrefix = @"
DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN""&
html;
head;
meta http-equiv=Content-Type content=""text/html; charset={0}"";
/head;
body>
<!--StartFragment-->
";
HtmlPrefix = string.Format(HtmlPrefix, encoding.WebName);
string HtmlSuffix = @"
!--EndFragment--;
/body;
/html;
";
// Get lengths of chunks
int HeaderLength = encoding.GetByteCount(Header);
HeaderLength -= 16; // extra formatting characters {0:000000}
int PrefixLength = encoding.GetByteCount(HtmlPrefix);
int HtmlLength = encoding.GetByteCount(html);
int SuffixLength = encoding.GetByteCount(HtmlSuffix);
// Determine locations of chunks
int StartHtml = HeaderLength;
int StartFragment = StartHtml + PrefixLength;
int EndFragment = StartFragment + HtmlLength;
int EndHtml = EndFragment + SuffixLength;
// Build the data
sb.AppendFormat(Header, StartHtml, EndHtml, StartFragment, EndFragment);
sb.Append(HtmlPrefix);
sb.Append(html);
sb.Append(HtmlSuffix);
//Console.WriteLine(sb.ToString());
return sb.ToString();
}
thanks for everything i have...
|
|
|
|
|
Hello,
We have choosen to use Microsoft Enterprise Library in a project that I am involved with. We wan't to write messages to the windows event log with Enterprise Library. I have succeseeded to with that but I have a question with information regarding the stacktrace. When I look at the event log (Windows 2003 server) I have the full stacktrace listed in the event log and in the bottom of the written event I have the message. I wan't to know how to write only the message to event log. I don't wan't to see the full stacktrace.
/Håkan
|
|
|
|
|
|
Hi
In my login form i have set user name Password as "admin" and "sa"
if i type ADMIN and SA it should not work but its working..
how resolve it
thanks in advance
|
|
|
|
|
Mads115 wrote: In my login form i have set user name Password as "admin" and "sa"
if i type ADMIN and SA it should not work but its working..
how resolve it
How did you checking the use id and password? Where is the code? Did you check with String.Equal() or what ?
|
|
|
|
|
this is the Code I am using
SqlConnection Con1 = new SqlConnection("server=.;database=ab;uid=sa;pwd=max");
Con1.Open();
SqlCommand cmd1 = new SqlCommand("select UserName,Password from mads Where Username= '" + usrtxt.Text + "' and Password ='" + passtxt.Text + "'", Con1);
SqlDataReader dr = cmd1.ExecuteReader();
dr.Read();
if (dr.HasRows == true)
{
prj = new Project_Details(usrtxt.Text);
prj.Show();
}
dr.close;
|
|
|
|
|
SQL is case insensitive. You have to force SQL to turn on the case sensitivity for the select query. Just add the following clause with your select query:
COLLATE SQL_Latin1_General_CP1_CS_AS
Use COLLATE SQL_Latin1_General_CP1_CI_AS for case insensitivity.
It can solve your problem.
Regards
Saanj
Either you love IT or leave IT...
|
|
|
|
|
Mads115 wrote: SqlCommand cmd1 = new SqlCommand("select UserName,Password from mads Where Username= '" + usrtxt.Text + "' and Password ='" + passtxt.Text + "'", Con1);
If this is your live code, Please be careful about SQL Injection .
|
|
|
|
|
Check out the following code:
if (string.Compare("hello", "Hello", false) == 0)
{
//do whatever you wish
}
The third parameter makes the string comparison case sensitive.
Regards
Saanj
Either you love IT or leave IT...
|
|
|
|
|
Hi, i have a problem about threads with windows forms.
When users's sessions ended, i want to show a dialog box to inform them to relogin and then to show the relogin form.
It was ok until i use threads in some forms to improve performance.
When a thread reveices a session error, it shows the relogin form. Actualy i use invoke on the main thread.
But while the dialog form is shown, another thread can make a service call and receive the same session error and so tries to show the same relogin form. But it is clear that only one instance of relogin form must be shown at the same time. So i have to use a locking mechanism. But since the thread that shows the dialog box is the main thread, this causes the main thread enter wait state. So the application freezes.
public bool Relogin() {
Interlocked.Increment(ref waitingThreadCount);
event1.WaitOne();
if(this.loginResult == null) {
loginResult = ReloginForm.Show();
}
Interlocked.Decrement(ref waitingThreadCount);
if(waitingThreadCount == 0) {
loginResult = null;
}
event1.Set();
return loginResult.Value;
}
modified on Thursday, June 11, 2009 2:40 AM
|
|
|
|
|
Hi,
I have CrystalActiveXReportViewerLib11_5.dll for my application. I have used a typed Dataset. In this DataSet there are two DataTables DataTable1 and DataTable2. DataTable1 is used for main report and DataTable2 is for SubReport. When i set DataSource for both DataTable i got a problem. For only one dataTable it is ok.
Any help for this problem is appreciated. It is urgent. My code is like this:
DataTable dtt1 = LoadDataTable();
DataTable dtt2 = LoadFriendDataTable();
CRAXDDRT.Application crxApp = new CRAXDDRT.Application();
CRAXDDRT.Report crxReport = new CRAXDDRT.Report();
crxReport = crxApp.OpenReport(Application.StartupPath+"\\rptHouseLandTaxLetter.rpt",null);
crxReport.Database.Tables[1].SetDataSource(dtt1, null);
//crxReport.Database.Tables[2].SetDataSource(dtt2, null); //error occurred here
this.crViewer.ReportSource = crReport;
this.crViewer.ViewReport();
private DataTable LoadDataTable()
{
CrystalReportTest1.DataSet1.DataTable1DataTable dtReport = new DataSet1.DataTable1DataTable();
foreach (DataRow dr in dt.Rows)
{
dtReport.Rows.Add(dr.ItemArray);
}
return dtReport;
}
private DataTable LoadFriendDataTable()
{
CrystalReportTest1.DataSet1.DataTable2DataTable frienddt = new DataSet1.DataTable2DataTable();
foreach (DataRow dr in dt.Rows)
{
frienddt.Rows.Add(dr.ItemArray);
}
return frienddt;
}
modified on Wednesday, June 10, 2009 12:59 AM
|
|
|
|
|
Hi,
I am trying to add ecgraph3d control to my project using VS 2005, the error "failed to import the activex control. please ensure it is properly registered" poped up.
I need help to fix this problem. Thank a lot in advance!
Brandon.
|
|
|
|
|
Have you registered the control ?
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Yes, I did register control using regsvr32.exe
I have been using a lot of ocx control so far and this is the only one give me that error.
Thanks,
Brandon
|
|
|
|
|
Assuming your control got registered successfully, try clearing all the files in obj/debug or obj/release. Now try to add the control again.
If you have problem in registering control using regsvr32 , use dependency walker and profile regsvr32 by specifying the dll to be registered.
|
|
|
|
|
Navaneeth,
I have tried many time to delete the files in obj and debug folder but the error is still there.
I am not sure I have problem using regsvr32 or not since I have used to register a lot of controls so far. All works fine, except this control ecgraph3D.ocx
How can I use dependency walker and profile regsvr32 ?
Many thanks,
Brandon
|
|
|
|
|
brandonwong123 wrote: I am not sure I have problem using regsvr32 or not
The problem is obviously going to be specific to the control.
Does the control come with any samples ? Do they work ?
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Christian,
The control comes with visual basic 6 example and it works on my machine. This company has ecgraph.ocx and it works on my visual studio 2005. Now they just have ecgraph3D.ocx as their new product but this control doesn't want to work on my C# 2005
Thanks,
Brandon
|
|
|
|