Click here to Skip to main content
15,887,343 members
Home / Discussions / C#
   

C#

 
GeneralRe: SplitContainer problem Pin
lune1222-Jul-09 4:04
lune1222-Jul-09 4:04 
GeneralRe: SplitContainer problem Pin
Muhammad Mazhar22-Jul-09 4:22
Muhammad Mazhar22-Jul-09 4:22 
Questionhow to get datagrid previously selected column index in c#.net Pin
swetha_insoft22-Jul-09 3:14
swetha_insoft22-Jul-09 3:14 
AnswerRe: how to get datagrid previously selected column index in c#.net Pin
swetha_insoft22-Jul-09 3:18
swetha_insoft22-Jul-09 3:18 
AnswerRe: how to get datagrid previously selected column index in c#.net Pin
Muhammad Mazhar22-Jul-09 3:52
Muhammad Mazhar22-Jul-09 3:52 
QuestionTCP Window Scaling Pin
satsumatable22-Jul-09 2:16
satsumatable22-Jul-09 2:16 
AnswerRe: TCP Window Scaling Pin
led mike22-Jul-09 4:35
led mike22-Jul-09 4:35 
QuestionUser control problem in databind Pin
beesan22-Jul-09 2:05
beesan22-Jul-09 2:05 
Hello All;
i make a user control on c# using ultragrid control the problem is when i take the dll in order to use it in other projects the data doesnt appear, the grid reads the data from the data base

the code of the user control:
the grid name here is ulGrid



public partial class GridUserControl : UserControl<br />
{<br />
Infragistics.Win.UltraWinGrid.UltraGrid ulGrid = new UltraGrid();<br />
Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter ulExcel = new UltraGridExcelExporter();<br />
Infragistics.Win.UltraWinGrid.UltraGridPrintDocument ulPrint = new Infragistics.Win.UltraWinGrid.UltraGridPrintDocument();<br />
<br />
<br />
bool GridRightLeft;<br />
string HeaderTitle;<br />
string HeaderRightDetails;<br />
string HeaderLeftDetails;<br />
<br />
public GridUserControl()<br />
{<br />
InitializeComponent();<br />
ulItasGrid.ContextMenuStrip = contextMenuStrip1;<br />
}<br />
<br />
public delegate void GridEventKeyDown(object sender,KeyEventArgs e);<br />
public delegate void GridEventKeyUp(object sender, KeyEventArgs e);<br />
public delegate void GridEventMouseDown(object sender, KeyEventArgs e);<br />
public delegate void GridEventMouseClick(object sender, KeyEventArgs e);<br />
<br />
<br />
<br />
<br />
public bool GridRightToLeft<br />
{<br />
set<br />
{<br />
GridRightLeft = value;<br />
}<br />
get<br />
{<br />
return GridRightLeft;<br />
}<br />
}<br />
<br />
<br />
public string LeftDetails<br />
{ <br />
set<br />
{<br />
HeaderLeftDetails = value;<br />
}<br />
get<br />
{<br />
return HeaderLeftDetails;<br />
}<br />
}<br />
public string RightDetails<br />
{<br />
set<br />
{<br />
HeaderRightDetails = value;<br />
}<br />
get<br />
{<br />
return HeaderRightDetails;<br />
}<br />
}<br />
DataTable dt = new DataTable();<br />
public DataTable DataTableSource<br />
{ set<br />
{<br />
// dt = value;<br />
// MessageBox.Show("Befor Set" + dt.Rows.Count.ToString() + " and Columns Count IS : " + value.Columns.Count.ToString());<br />
ulGrid.DataSource = dt;<br />
// ulGrid.DataBind();<br />
// MessageBox.Show("After Set" + dt.Rows.Count.ToString() + " and Columns Count IS : " + value.Columns.Count.ToString());<br />
}<br />
<br />
<br />
get<br />
{<br />
//dt = new DataTable();<br />
//dt = DataTableSource;<br />
//MessageBox.Show("Get Set" + dt.Rows.Count.ToString() + " and Columns Count IS : " + dt.Columns.Count.ToString());<br />
return dt;<br />
}<br />
<br />
}<br />
<br />
//public object DataSource<br />
//{<br />
// set<br />
// {<br />
// ulGrid.DataSource = value; <br />
// }<br />
// get<br />
// { return ulGrid.DataSource; }<br />
//}<br />
<br />
public object DataSource<br />
{<br />
get<br />
{<br />
return ulGrid.DataSource;<br />
}<br />
set<br />
{<br />
// bind the given datasource<br />
ulGrid.DataSource = value;<br />
<br />
try<br />
{<br />
ulGrid.DataBind();<br />
}<br />
catch (Exception ex)<br />
{<br />
throw new Exception(String.Format("Could not bind data to grid"));<br />
}<br />
}<br />
}<br />
<br />
public string DataMember<br />
{<br />
set { ulGrid.DataMember = value; }<br />
get { return ulGrid.DataMember; }<br />
<br />
}<br />
<br />
<br />
<br />
public string HeaderReport<br />
{<br />
set<br />
{<br />
HeaderTitle = value;<br />
}<br />
get<br />
{<br />
return HeaderTitle;<br />
}<br />
}<br />
<br />
public AutoFitStyle AutoFit<br />
{<br />
set<br />
{<br />
this.ulItasGrid.DisplayLayout.AutoFitStyle = Infragistics.Win.UltraWinGrid.AutoFitStyle.ResizeAllColumns;<br />
}<br />
get<br />
{<br />
return this.ulItasGrid.DisplayLayout.AutoFitStyle;<br />
}<br />
}<br />
<br />
public Color Appearance<br />
{<br />
set<br />
{ <br />
this.ulItasGrid.DisplayLayout.Appearance.BackColor = Color.White;<br />
}<br />
get { <br />
return this.ulItasGrid.DisplayLayout.Appearance.BackColor;<br />
}<br />
}


and the code of the connection class for testing the grid:


<br />
using System;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using System.Text;<br />
using System.Data.SqlClient;<br />
using System.Configuration;<br />
using System.Data;<br />
<br />
<br />
namespace testthegrid<br />
{<br />
class Connection<br />
{<br />
SqlConnection ConnectionStr = new SqlConnection();<br />
<br />
public Connection()<br />
{<br />
ConnectionStr.ConnectionString = "Data Source=.; Initial Catalog=GridExample;Integrated Security=SSPI";<br />
}<br />
<br />
public SqlConnection conn<br />
{<br />
get<br />
{<br />
return this.ConnectionStr;<br />
}<br />
set<br />
{<br />
this.ConnectionStr = value;<br />
}<br />
}<br />
<br />
<br />
public void OpenConnection()<br />
{<br />
if (ConnectionStr.State != ConnectionState.Open)<br />
ConnectionStr.Open();<br />
}<br />
<br />
<br />
public void CloseConnection()<br />
{<br />
try<br />
{<br />
if (ConnectionStr.State != ConnectionState.Closed)<br />
ConnectionStr.Close();<br />
}<br />
catch { }<br />
}<br />
}<br />
}


and the code for testing the grid is:

<br />
namespace testthegrid<br />
{<br />
public partial class Form1 : Form<br />
{<br />
private Connection connection = new Connection();<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
FillGrid();<br />
}<br />
private void FillGrid()<br />
{<br />
connection.OpenConnection();<br />
DataTable dt = new DataTable();<br />
SqlDataAdapter da = new SqlDataAdapter("select * from AccountInfoA", connection.conn);<br />
da.Fill(dt);<br />
gridUserControl1.DataTableSource = dt;<br />
connection.CloseConnection();<br />
<br />
}



there is no data appears in the grid
thanx a lot
AnswerRe: User control problem in databind Pin
Nagy Vilmos22-Jul-09 3:11
professionalNagy Vilmos22-Jul-09 3:11 
GeneralRe: User control problem in databind Pin
beesan22-Jul-09 20:09
beesan22-Jul-09 20:09 
QuestionHow to Save word file using SaveDialogBox and File Stream Pin
mandar77722-Jul-09 1:41
mandar77722-Jul-09 1:41 
AnswerRe: How to Save word file using SaveDialogBox and File Stream Pin
Brij22-Jul-09 2:01
mentorBrij22-Jul-09 2:01 
GeneralRe: How to Save word file using SaveDialogBox and File Stream Pin
mandar77722-Jul-09 2:19
mandar77722-Jul-09 2:19 
AnswerRe: How to Save word file using SaveDialogBox and File Stream Pin
Adam R Harris22-Jul-09 6:18
Adam R Harris22-Jul-09 6:18 
Questionhandling add contact event in outlook 07 Pin
ACMA_198022-Jul-09 1:16
ACMA_198022-Jul-09 1:16 
AnswerRe: handling add contact event in outlook 07 Pin
satsumatable22-Jul-09 3:52
satsumatable22-Jul-09 3:52 
GeneralRe: handling add contact event in outlook 07 Pin
ACMA_198022-Jul-09 23:40
ACMA_198022-Jul-09 23:40 
Questionlabel is not becoming visible Pin
Mahesh_Blr22-Jul-09 1:05
Mahesh_Blr22-Jul-09 1:05 
AnswerRe: label is not becoming visible Pin
musefan22-Jul-09 1:09
musefan22-Jul-09 1:09 
AnswerRe: label is not becoming visible Pin
Manas Bhardwaj22-Jul-09 1:11
professionalManas Bhardwaj22-Jul-09 1:11 
AnswerRe: label is not becoming visible Pin
Nagy Vilmos22-Jul-09 1:59
professionalNagy Vilmos22-Jul-09 1:59 
Questionc# adding events to programmaticlly added controls Pin
allexserban22-Jul-09 0:55
allexserban22-Jul-09 0:55 
AnswerRe: c# adding events to programmaticlly added controls Pin
DaveyM6922-Jul-09 1:03
professionalDaveyM6922-Jul-09 1:03 
AnswerRe: c# adding events to programmaticlly added controls Pin
Luc Pattyn22-Jul-09 1:05
sitebuilderLuc Pattyn22-Jul-09 1:05 
GeneralRe: c# adding events to programmaticlly added controls Pin
Nagy Vilmos22-Jul-09 1:10
professionalNagy Vilmos22-Jul-09 1:10 

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.