All Answers

0 votes

Still not seems to work in 2.1.78

Can you give me a working sample of a filled datagrid that adapt row height (and wrap content) by code?

Thank you,

Adrian

0 votes

Hi Adrian,

it´s fixed in Wisej development build 2.1.78 that has just been released.

Best regards
Frank

0 votes

Try the attached patch. Put in /Platforms or /Resources and set to Embedded Resource in AssemblyInfo uncomment the WisejResource attribute.

  • Luca answered Jul 4, 2020 - 4:27 pm
0 votes

There is a regression in the javascript. Will fix in a dev build. I’m not sure I can have a patch before then.

  • Luca answered Jul 4, 2020 - 4:18 pm
1 vote

Yes the LongTap is the tablet and mobile equivalent of the right click. I think the library converts a long click (press the mouse and keep it pressed) to a long tap on desktops. You can always check the environment using Application.Browser.Device (https://wisej.com/docs/2.1/html/T_Wisej_Core_ClientBrowser.htm).

  • Luca answered Jul 4, 2020 - 4:09 pm
0 votes

OK – I have worked around it using the LongTap event (not sure this is correct). I also saw recommendations to use CellMouseUp rather than MouseClick (saves checking the cell is a cell, not a header or the white-space). My code for showing the ContextMenu is:

private void grdTests_LongTap(object sender, EventArgs e)
{
Wisej.Web.DataGridView.HitTestInfo htInfo = grdTests.HitTest(grdTests.PointToClient(Cursor.Position).X, grdTests.PointToClient(Cursor.Position).Y);

int iRow = htInfo.RowIndex;
int iCol = htInfo.ColumnIndex;

if (iRow >= 0 && iCol >= 0) // has to be a cell, not a header or after the last row
{
string sTestID = grdTests[“RECORDID”, iRow].Value.ToString();

cmTest.Tag = sTestID;
cmTest.Show(grdTests, grdTests.PointToClient(Cursor.Position), null);
}

}

0 votes

I tried on 2.1.77. You have here a sample of code. Until 2.1.76 (included) that code works weird because of (sometimes big) not visible columns. Now it’s not working at all. I mean, nothing happens when I run that code with wrapText true/false.

Can you give me a working sample of a filled datagrid that adapt row height (and wrap content) by code?

Thank you,

Adrian

 

public static void AutoSizeTable(ref DataGridView dg, autoSizeTableMode tip, bool? wrapText = false)
{
try
{
var ds = dg.DataSource;
dg.DataSource = null;
switch (tip)
{
//bla-bla…
case autoSizeTableMode.Equal://user defined mode

for (int i = 0,nr_visible=0; i < dg.ColumnCount; i++,nr_visible+=((dg.Columns[i].Visible)?1:0));
for (int i = 0; i < dg.ColumnCount; i++)
dg.Columns[i].Width = dg.Width / nr_visible;
break;
//bla-bla…
default:
break;
}
if (wrapText != null)
for (int i = 0; i < dg.ColumnCount; i++)
dg.Columns[i].DefaultCellStyle.WrapMode = ((bool)wrapText ? DataGridViewTriState.True : DataGridViewTriState.False);
dg.DataSource = ds;
if (wrapText != null) dg.AutoResizeRows();
}
catch (Exception ex)
{
//bla-bla…
}
}

0 votes

Hi Glenn,

#2319 is fixed in Wisej release 2.1.77

Best regards
Frank

0 votes

Hi Adrian,

issue #2324 is fixed in Wisej release 2.1.77

Best regards
Frank

0 votes

Perfect! Thank you again for you help!

0 votes

See attached.

  • You don’t need to set the CellTemplate, the DataGridViewButtonColumn already uses the correct template.
  • Buttons labeled “Except Firefox” work with Chrome, Edge and IE11.
  • Buttons labeled “Including Firefox” work on all browsers.
  • The first two columns are DataGridViewButtonColumn
  • The last two columns create a button control in each cell (not recommended)
  • Look at the ClientEvents collection in the DataGridView and the buttons labeled “Including Firefox.”
  • The expression “App.MainPage.upload1” may change depending on where you put the upload control.

HTH

  • Luca answered Jul 3, 2020 - 5:23 pm
0 votes

First: I managed to resolve with “independent” buttons. Meaning the standalone ones (I needed some time for me to understannd the concept).

 

Questions:

1. please give me a sample how to put this.getParent().u.upload() on ClientEvent, for execute, in code.

 

2. I have a DatagridView with a column template DataGridViewButtonCell. On code, it’s like:

var lc = new DataGridViewButtonColumn();

lc.CellTemplate = new DataGridViewButtonCell();

lc.DataPropertyName = dt.Columns[i].ColumnName;

lc.Name = dt.Columns[i].ColumnName;

lc.CellTemplate.Style.ForeColor = System.Drawing.Color.Navy;

dg.Columns.Add(lc);

 

When user click on cell, I have code on CellMouseClick event, and I want to initiate a file upload. Please give me a solution on how to accomplish that.

Or a way to initiate a file upload when click a cell, on a specific column.

Thank you for very quick reaction!

0 votes

You cannot call u.UploadFiles() in Firefox, it will block the event. You need to call the event on the client side.

You can set all the properties in the designer. The only property that must be set in OnLoad is upload.Visible = true otherwise the client widget is not created for invisible controls until they are made visible once or used in a client call. If you send a small test case I can fix it for you.

You can attach client events to the dynamically created buttons using button1.ClientEvents.Add(…) or button1.AddClientEventListener()

https://wisej.com/docs/2.1/html/P_Wisej_Web_Control_ClientEvents.htm

https://wisej.com/docs/2.1/html/M_Wisej_Web_Control_AddClientEventListener.htm

 

 

  • Luca answered Jul 3, 2020 - 2:43 pm
0 votes

I did what you told me, but I encounter 2 problems:

First one:

  1. I put an upload control on form (named u),
  2. in Load event of the form I put:
    u.Uploaded += U_Uploaded;
    u.AllowMultipleFiles = false;
    u.AllowedFileTypes = “.pdf”;
    u.UploadFiles(); //without that on the first click it doesn’t fire ?!?!
  3. On the Button click event I put u.UploadFiles();

Without the u.UploadFiles(); called without effect on form.Load, at the first push of the button nothing happens. On the secont, third, etc it works. It’s a bug?

edit: step 3 this is not necessary; it’s stupid me! On button.Click no code is necessary, the javascript fires u.UploadFiles(); Still, withou calling u.UploadFiles(); on form.Load it’s not working.

Second problem (and that’s the big one):

I have tables (datagridview) with (some) columns as buttons (DataGridViewButtonCell). Some of them must upload files. I’m not sure how can I use that mechanism with dinamically created buttons? I mean the the event triggered is CellMouseClick. How can I  attach a client side event to the button by code?

Thank you,

Adrian

  • Adrian Zagar answered Jul 3, 2020 - 2:28 pm
  • last active Jul 3, 2020 - 2:42 pm
0 votes

You can also use the upload control directly and make it look like a button easily:

Set upload1.ShowValue = false.

If you want to change the colors or the icon you can.

If you want to use the same theme as a regular button set the AppearanceKey property to “button”.

  • Luca answered Jul 3, 2020 - 1:26 pm
0 votes

The upload works well in all browsers. It’s the server-side triggering that is blocked by some browsers and some versions of the the browser because they don’t allow certain actions to be started without a user interaction  (a click). The way to make  it work is to attache a client side event to the button like the attached screenshot.

Also in your code you are creating a new upload control on each click, it will create a new <input> in the browser each time. You should create the upload control once. Drop it on the page and make it not visible on OnLoad().

  • Luca answered Jul 3, 2020 - 1:23 pm
0 votes

If you enable the exceptions in VS and turn off “Just My Code” it will break exactly at the line of code that throws the exception. See screenshots attached. If it doesn’t break it means it’s not set up correctly.

Debug mode is turned in web.config

<system.web>
<compilation debug=”true” />

When that is on Wisej sends back the entire stack trace. In your screen shot it’s empty. Also the exception sent back should be displayed on the screen. Since it doesn’t there is something else wrong. Can you send me a link privately at support at wisej.com that I can try?

 

  • Luca answered Jul 3, 2020 - 1:14 pm
0 votes

Following up for visibility. Replied in a comment section

 

UPDATE:

Once I added Application.CurrentDomain.FirstChanceException handler in WiseJ app, I can see what server side errors appears when this issue reproduced.
There’re 2 errors thrown: (my logger looks like: Log(“CurrentDomain_FirstChanceException error:” + e.Exception.ToString());

  1. CurrentDomain_FirstChanceException error: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Cannot perform runtime binding on a null reference
    at Microsoft.CSharp.RuntimeBinder.RuntimeBinder.BindProperty(DynamicMetaObjectBinder payload, ArgumentObject argument, LocalVariableSymbol local, EXPR optionalIndexerArguments, Boolean fEventsPermitted)
  2. CurrentDomain_FirstChanceException error: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Cannot perform runtime binding on a null reference
    at CallSite.Target(Closure , CallSite , Object )

 

Unfortunately, the stack trace looks quite poorly 🙁

  • Michael M answered Jul 3, 2020 - 3:24 am
  • last active Jul 3, 2020 - 8:05 am
0 votes
In reply to: Visual web gui support

Contact sales at wisej.com.

  • Luca answered Jul 2, 2020 - 10:37 pm
0 votes

We don’t have a SetStyle() method. If this is VWG code it cannot work with Wisej.

Use this.textBox1.CssStyle = “border:5px solid red”;

  • Luca answered Jul 2, 2020 - 10:36 pm
Showing 4721 - 4740 of 11k results