Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
243 views
Hello!

I need help figuring out how to pass the primary key value to the btnSave inside an EditForm. What I'd like to do is to get the primary key as a CommandArgument so I do some logic with it, but what I get is an error that the input string was not in a correct format with a following line in codebehind as a problem:

int value = Convert.ToInt32(e.CommandArgument);


Here is the codefront:

<telerik:RadGrid ID="gvKontakti" runat="server" AllowPaging="True" AllowSorting="True"
    CellSpacing="0" GridLines="None" DataKeyNames="idKontakt" AutoGenerateColumns="false"
    OnDeleteCommand="gvKontakti_DeleteCommand" OnEditCommand="gvKontakti_EditCommand"
    OnInsertCommand="gvKontakti_InsertCommand">
    <MasterTableView CommandItemDisplay="TopAndBottom">
        <Columns>
            <telerik:GridEditCommandColumn UniqueName="EditCommandColumn">
            </telerik:GridEditCommandColumn>
            <telerik:GridBoundColumn UniqueName="Naziv" HeaderText="Naziv" DataField="Naziv">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="Funkcija" HeaderText="Funkcija" DataField="Funkcija">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="Tel1" HeaderText="Telefon 1" DataField="Tel1">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="Tel2" HeaderText="Telefon 2" DataField="Tel2">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="Mob1" HeaderText="Mobitel 1" DataField="Mob1">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="Mob2" HeaderText="Mobitel 2" DataField="Mob2">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="Email1" HeaderText="E-mail 1" DataField="E-mail1">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="Email2" HeaderText="E-mail 2" DataField="E-mail2">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="Fax" HeaderText="Fax" DataField="Fax">
            </telerik:GridBoundColumn>
        </Columns>
        <EditFormSettings EditFormType="Template">
            <EditColumn UniqueName="EditColumn">
            </EditColumn>
            <FormTemplate>
                <table>
                    <tr>
                        <td>
                            Ime:
                        </td>
                        <td>
                            <asp:TextBox ID="txtIme" runat="server" Text='<%# Bind("Ime") %>'></asp:TextBox>
                        </td>
                        <td>
                            Prezime:
                        </td>
                        <td>
                            <asp:TextBox ID="txtPrezime" runat="server" Text='<%# Bind("Prezime") %>'></asp:TextBox>
                        </td>
                    </tr>
                </table>
                <asp:Button ID="btnSave" CommandName="Save" Text="Spremi" runat="server" />
                <asp:Button ID="btnDelete" CommandName="Delete" Text="Delete" runat="server" />
            </FormTemplate>
        </EditFormSettings>
    </MasterTableView>
protected void gvKontakti_EditCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            int idKontakt = 0;
            int value = Convert.ToInt32(e.CommandArgument);
 
            if (e.CommandName == "Spremi")
            {
                TSEntities db = new TSEntities();
                Kontakt kontakt = new Kontakt();
 
                if (idKontakt > 0)
                {
                    kontakt = db.Kontakts.SingleOrDefault(k => k.idKontakt == idKontakt);
 
                    TextBox txtIme = (TextBox)gvKontakti.FindControl("txtIme");
                    TextBox txtPrezime = (TextBox)gvKontakti.FindControl("txtPrezime");
                    TextBox txtFunkcija = (TextBox)gvKontakti.FindControl("txtFunkcija");
                    TextBox txtTel1 = (TextBox)gvKontakti.FindControl("txtTel1");
                    TextBox txtTel2 = (TextBox)gvKontakti.FindControl("txtTel2");
                    TextBox txtMob1 = (TextBox)gvKontakti.FindControl("txtMob1");
                    TextBox txtMob2 = (TextBox)gvKontakti.FindControl("txtMob2");
                    TextBox txtFax = (TextBox)gvKontakti.FindControl("txtFax");
                    TextBox txtEmail1 = (TextBox)gvKontakti.FindControl("txtEmail1");
                    TextBox txtEmail2 = (TextBox)gvKontakti.FindControl("txtEmail2");
                    TextBox txtAdresa1 = (TextBox)gvKontakti.FindControl("txtAdresa1");
                    TextBox txtAdresa2 = (TextBox)gvKontakti.FindControl("txtAdresa2");
                    TextBox txtAdresa3 = (TextBox)gvKontakti.FindControl("txtAdresa3");
                    TextBox txtGrad = (TextBox)gvKontakti.FindControl("txtGrad");
                    TextBox txtPBR = (TextBox)gvKontakti.FindControl("txtPBR");
                    TextBox txtDrzava = (TextBox)gvKontakti.FindControl("txtDrzava");
                    TextBox txtBiljeske = (TextBox)gvKontakti.FindControl("txtBiljeske");
                    CheckBox chkAktivan = (CheckBox)gvKontakti.FindControl("chkAktivan");
 
                    kontakt.Ime = txtIme.Text;
                    kontakt.Prezime = txtPrezime.Text;
                }
                else
                {
 
                }
                db.SaveChanges();
            
            }
        }


Any help would be appreciated.
Jayesh Goyani
Top achievements
Rank 2
 answered on 23 Aug 2011
3 answers
62 views
I am not able to shoe recurring appointments in radschedular. Non-Recurring Appointments are shown ok. I am binding radschedular with XML. I am attaching all important code needed  with the post(Xml,Default.aspx code and Default.aspx.cs Code).  Pls help me with this.


Thanks
Peter
Telerik team
 answered on 23 Aug 2011
1 answer
240 views
Hi,

I have requirement where i need to change the border color of RadDateTimePicker textbox and i want this through javascript.
I mean like RadDateTimePickerTextBox.style.border = "Red".

Can anyone tell me how can i get this for RadDateTimePicker through javascript ?

Thanks,
--Jai
Maria Ilieva
Telerik team
 answered on 23 Aug 2011
9 answers
736 views
If you set the AutoPostBackOnFilter = true the filtering will start when you hit return, or click the filter button, but unfortunately, it will also start as soon as the filter goes out of focus (you move focus to something else) which prevents you from entering more than one search criteria before the filtering starts. How do you make it so that only return and click on filter image fires the filterning event?

Are we the only ones thinking that the "fire event when the filter textbox goes out of focus" is a strange default behaviour, or have we missed something here? I would say that pressing return or clicking on the filter image should be the default.
Tsvetina
Telerik team
 answered on 23 Aug 2011
4 answers
135 views
Hi,

I got this bug raised by my QA Team. Please see screenshot for detail.

Is there any way you could help?

Thanks
Navnit
Navnit
Top achievements
Rank 2
 answered on 23 Aug 2011
1 answer
64 views
Hi,
    Could some one tell if something similar to this http://demos.telerik.com/aspnet-ajax/grid/examples/client/keyboardnavigation/defaultcs.aspx, involving the RADGrid can be done with a RADTreelist.
Radoslav
Telerik team
 answered on 23 Aug 2011
1 answer
84 views
Hello,

I am wondering if it is possible to implement image resize handlers in Safari. I came across this thread - http://www.telerik.com/community/forums/aspnet-ajax/editor/can-t-select-images-in-safari-or-chrome.aspx and it seems the answer is currently no. Please advise.

Thank you.
Rumen
Telerik team
 answered on 23 Aug 2011
0 answers
1.5K+ views

The RadWindow is a client-side object – its UI is created when it is first shown and this is the point when the CSS and scripts are loaded as well. This means that it should be used on the client via JavaScript, yet it turns out that it is a very common scenario that the developer wishes to initiate the RadWindow’s showing from the code-behind.


The VisibleOnPageLoad property should not be used for this purpose. It is a behavior property which will result in the RadWindow opening every time the page is post back.

Quite often the VisibleOnPageLoad property gets set to true while the intention is that the RadWindow should only show once. Doing so will result in the RadWindow reopening if a postback is initiated from another element from the page, which is rarely the desired behavior. Also, this approach will not work in case this happens in an AJAX request and the RadWindow is not included in the partial page update.

There are several ways to work around this:
1) Register a JavaScript function from the server-side and do not use the VisibleOnPageLoad property, for example:

<telerik:RadWindow runat="server" ID="RadWindow1" NavigateUrl="http://google.com/"></telerik:RadWindow>
<asp:Button ID="Button1" Text="open the RadWindow from the server" runat="server" OnClick="Button1_Click" />
C#
protected void Button1_Click(object sender, EventArgs e) 
{ 
    //business logic goes here 
   
    string script = "function f(){$find(\"" + RadWindow1.ClientID + "\").show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"; 
    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true); 
}


VB:
Protected Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click 
    'business logic goes here 
   
    Dim script As String = "function f(){$find(""" + RadWindow1.ClientID + """).show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"
    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, True) 
End Sub


2) Reset the VisibleOnPageLoad property to false with code when suitable, depending on the particular scenario

3) Set EnableViewState to false for the RadWindowManager that contains the desired RadWindows

Telerik Admin
Top achievements
Rank 1
Iron
 asked on 23 Aug 2011
7 answers
197 views
I'm using the most updated version of Q1 2009 and in Chrome 3 and Safari 4, when I click on an image, the resize handles don't appear and when I right click on an image, the context menu shows up, but when I click on any of the menu items, the menu disappears and nothing happens.
Peter
Telerik team
 answered on 23 Aug 2011
1 answer
130 views
Hi,
I have a combobox bound to a webservice, if I enter "1-" then the following filtered results are shows  "1-a" & "1-b".
"1-a" is ticked, then a search value of  "2-" is entered.
 "2-a" is ticked.
After closing the combobox "1-a" is no longer selected.

It appears that the combo box loses it checked items that are no longer displayed in the filtered results.
Is their any way around this?

         <telerik:RadComboBox ID="RadComboBox1" Runat="server" Width="98%"
                    CheckBoxes="True" Filter="Contains" EnableEmbeddedSkins="true" EnableLoadOnDemand="true" >
                    <WebServiceSettings Path="webservices/MainSearch.asmx" Method="Rooms" />
                </telerik:RadComboBox>

Brian Taylor
Top achievements
Rank 1
 answered on 23 Aug 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?