Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
129 views
We are trying to implement the ability to enable a client to upload an image which will then be redisplayed via the Binary Image control. Does anyone have any ideas on how we run any sort of antivirus on this type of upload?
Regards,
Mark Austin
T. Tsonev
Telerik team
 answered on 27 Aug 2010
3 answers
144 views
Hi,

it's very easy to make a list of items scrollable - and it works like a charm.
Except one thing - the scroll position.

Assume the users scrolls down and selects an item.
Then he expands another group (SingleSelect mode is set).
Later he expands the previously selected group.
He sees the items list - but the selected one is "somewhere".

The same problem happens with data binding.
Assume a serverside selected item - way down in the scroll area.

So what the user gets is a "where is the item" situation.

My first thought was to use the "OnClientItemExpand" event.
The documentation says:
OnClientItemExpand occurs immediately after an item is expanded

But "after" is not really after as it looks.
My first approach was this:
Snippet created with CBEnhancer
function OnExpand(sender, args) {
    var iTem = args.get_item();
    if (iTem.get_level() != 0) {
        return;    //only interest in top level items
    }
    var items = iTem.get_items();
    for (var i = 0; i < items.get_count(); i++) {
        if (items.getItem(i).get_selected()) {
            items.getItem(i).focus();
            return;
        }
    }
}
This results in a stack overflow - it seems setting the focus calls OnExpand again.
Not really a problem - I locked the function like this:
Snippet created with CBEnhancer
var didFocus = false;
function OnExpand(sender, args) {
    if (didFocus) {
        return;
    }
    var iTem = args.get_item();
    if (iTem.get_level() != 0) {
        return;    //only interest in top level items
    }
    var items = iTem.get_items();
    for (var i = 0; i < items.get_count(); i++) {
        if (items.getItem(i).get_selected()) {
            didFocus = true;
            items.getItem(i).focus();
            didFocus = false;
            return;
        }
    }
}
No more stack overflow - but an error message that an invisible item can't get the focus.
This makes me think the event fires not "after" it is expanded.
My final approach is:
Snippet created with CBEnhancer
var curSelItem;
function DoFocus() {
    curSelItem.focus();
}
function OnExpand(sender, args) {
    var iTem = args.get_item();
    if (iTem.get_level() != 0) {
        return;
    }
    var items = iTem.get_items();
    for (var i = 0; i < items.get_count(); i++) {
        if (items.getItem(i).get_selected()) {
            curSelItem = items.getItem(i);
            setTimeout("DoFocus()", 500);
            return;
        }
    }
}

This works - but I'm not really happy with that approach.
Assume somebody decides to use a longer animation duration or something like this.

If I set "ExpandDelay" to (let's say) 500 - my workaround does no long work.
OnClientItemExpand fires as soon as I click the expand arrow - and not (as documented) "immediately after an item is expanded".

My Question - is there a better approach to solve this problem?
Or did I miss something in the documentation?

Manfred
Peter
Telerik team
 answered on 27 Aug 2010
2 answers
216 views
Hi,

How can I center the 'OK' button in rad alert?

Thanks
Saravanan
saravanan k
Top achievements
Rank 1
 answered on 27 Aug 2010
1 answer
163 views
Hi,
I am tying to export my grid to PDF but it fails. I am attaching my files and code; please have a look and help.
Here is my code to export.

      grd.ExportSettings.ExportOnlyData = true;
            grd.ExportSettings.IgnorePaging = true;
            grd.ExportSettings.FileName = "Retailer Scenario PL";
            grd.ExportSettings.OpenInNewWindow = true;
            grd.MasterTableView.ExportToPdf();

Is there any way I can change the font size and margins  of exported file?
Shinu
Top achievements
Rank 2
 answered on 27 Aug 2010
1 answer
686 views
I have a grid column of button type:
<telerik:GridButtonColumn ButtonType=ImageButton ImageUrl="images/Img_Del.gif"></telerik:GridButtonColumn

I want to tie the button click to a javascript function. Is this possible?
I want to do an AJAX call from this function to perform the delete operation and refresh the grid.

 


Appreciate a reply.

thanks

 

Shinu
Top achievements
Rank 2
 answered on 27 Aug 2010
1 answer
170 views
Hi

I have a column containing a hashed password, and when the grid is in edit mode,
with the edit form displayed, I don't want the hashed form to appear, just a blank textbox.

I haven't been able to find the right event/method to clear the current content from the
textbox in the edit form, while allowing the new content that is typed in to be bound when
the update takes place.

The column is already a template column.
I am using Q2 2009 on this particular site.

Can you help? (VB preferred)

Thanks

Clive

Princy
Top achievements
Rank 2
 answered on 27 Aug 2010
1 answer
56 views
I'm constructing a User Control called "Hierarchy" inside of which is just one control, a RadTreeView.  I load it dynamically and then populate it forthwith.  All of that works fine.

With this treeview on the bottom-most nodes have any meaning with a Click event.

What's not working is that if the user clicks a non-bottom node (ie. a branch) then sometimes the treeview remains in the state that it is (good) but other times unexpected things happen with some/all of the branches closing.  I'm not sure why this phenomenon is occurring and how I can correct it.  Any advice would be much appreciated!

Robert

P.S. An alternative solution would be for me to simply disable the server-side click events of all the branch nodes and only have the click events enabled for the bottom-most nodes.  But I don't know if this is even possible or how to do it.
Robert
Top achievements
Rank 1
 answered on 27 Aug 2010
6 answers
193 views
Here is my grid:

<

 

telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource"

 

 

 

 

Height="100px" Width="600px" >

 

 

 

<MasterTableView AutoGenerateColumns="false" >

 

 

 

<Columns>

 

 

<telerik:GridBoundColumn DataField="ContactName" DataType="System.String"

 

 

HeaderText="Contact Name" ReadOnly="True"

 

 

>

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="Title" DataType="System.String"

 

 

HeaderText="Title" ReadOnly="True"

 

 

>

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="Email" DataType="System.String"

 

 

HeaderText="Email" ReadOnly="True"

 

 

>

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="Phone" DataType="System.String"

 

 

HeaderText="Phone" ReadOnly="True"

 

 

>

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="Fax" DataType="System.String"

 

 

HeaderText="Fax" ReadOnly="True"

 

 

>

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="ContactType" DataType="System.String"

 

 

HeaderText="Contact Type" ReadOnly="True"

 

 

>

 

 

</telerik:GridBoundColumn>

 

 

</Columns>

 

 

 

</MasterTableView>

 

 

<ClientSettings>

 

 

<Scrolling AllowScroll="True" UseStaticHeaders="True" />

 

 

</ClientSettings>

 

 

</telerik:RadGrid>

 

 

 

 

</td>

 

 

</tr>

 

 

</table>

 


Here is the click event:

 

protected void btnRecord_Click(object sender, EventArgs e)

 

{

RadGrid1.DataSource =

null;

 

RadGrid1.Rebind();

 

}


and down below is the needdatasource method:

protected

 

void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)

 

{

 

Contact curContact = new Contact();

 

curContact.ContactName = TextBox1.Text;

curContact.Title = TextBox2.Text;

curContact.Email = TextBox3.Text;

curContact.Phone = TextBox4.Text;

curContact.Fax = TextBox5.Text;

 

if (Session["ContactType"] != null)

 

{

curContact.ContactType = Session[

"ContactType"].ToString();

 

}

 

 

DataTable dt = new DataTable();

 

dt.Columns.Add(

"ContactName");

 

dt.Columns.Add(

"Title");

 

dt.Columns.Add(

"Email");

 

dt.Columns.Add(

"Phone");

 

dt.Columns.Add(

"Fax");

 

dt.Columns.Add(

"ContactType");

 

dt.Rows.Add(curContact.ContactName, curContact.Title, curContact.Email, curContact.Phone, curContact.Fax,

curContact.ContactType);

RadGrid1.DataSource = dt;

}


The binding occurs and populates the grid when the page loads for the first time. But in the button click event the rebind forces the needdatasource event to fire but does not do any binding with the new passed values.

Please help. Thanks.
Shamim
Top achievements
Rank 1
 answered on 27 Aug 2010
1 answer
94 views

Hi all,

I have a grid within an radajaxpanel and I'm looking to update a control in one itemtemplate when a control within another itemtemplate performs a post back (dropdownlist, radiobuttonlist, etc) for that row.

This is not for insert or updating, i'm using the grid for proper formatting. So my question is what event is raised when a control posts back within an item template, and how can I find the control within that row? I've tried adding a handler to the control but it does not fire when the control is within the itemtempate.

Thanks,

John
Mooka
Top achievements
Rank 1
 answered on 26 Aug 2010
7 answers
164 views
Greetings,

   I am curious as to what I should expect the behavior to be of a page which utilizes a RadAjaxPanel and functions correctly on the dev box (ASP.NET Development Server, VS 2008 .NET 3.5) but it is subsequently deployed to a server that does not have Ajax (AjaxControlTookit etc.) installed or configured properly. Ex. tell would be AjaxControlToolkit.dll not in bin.

   As far as I can tell the ajax simply does not work, but the app continues to work correctly as if the ajax panel(s) had never been. Does this make sense? We are using Q3 2009 wihtout SP1 or SP2. This question is specific to RadAjaxPanel, but also could be 100% the same answer behavior as the out of the box UpdatePanel etc. Unfortunately in my build for the day on the server I only have the one spot where postback is not async like I expect it to be (and it is on my localhost). So I can't go check a second page for the same behavior.

   On localhost I can see the post data has __ASYNCPOST true, and the param is missing for the autopostback request on the server implicating the default of false. Also RadAJAXControlID parameter is missing in post (for just the real server).

Thank-You,
   Justin
Donna
Top achievements
Rank 1
 answered on 26 Aug 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?