Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
201 views
I've been searching everywhere and not found the right combination of what will fix my problem. I have a DetailTables inside a grid, It has the internal Add new record from the CommandItemDisplay and a GridEditCommandColumn. It is using an FormTemplate for Editing and in that formtemplate I have a Label which is filled with the VcnCd from the parent grid. My problem is that when I click on the edit button that label is filled correctly with the VcnCd, but when I click the Add new button that label is empty. I have spent a lot of hours trying to find how to fill that label in the code behind with no luck. the label I'm trying to fill with the correct value is lblvType. I could use some help I'm doing this in VB. Here is my grid.
 
<telerik:RadGrid ID="grdVcntn" runat="server" AutoGenerateColumns="false">
  <ClientSettings>
    <Scrolling AllowScroll="True" UseStaticHeaders="True" />
  </ClientSettings>
  <MasterTableView EditMode="PopUp" CommandItemDisplay="Top" ShowHeader="true" AutoGenerateColumns="false" DataKeyNames="VcnCd">
     <NoRecordsTemplate>
      There are no records for this person.
    </NoRecordsTemplate>
    <CommandItemTemplate>
      <asp:LinkButton ID="LinkButton1" runat="server" CommandName="InitInsert" >
        <img style="border:0px" alt="Add" src="../images/plus.gif" /> Add new Record
      </asp:LinkButton>
    </CommandItemTemplate>
    <Columns>
      <telerik:GridEditCommandColumn ButtonType="imageButton" EditImageUrl="../images/Edit.gif"></telerik:GridEditCommandColumn>
      <telerik:GridBoundColumn HeaderText="VcnCd" DataField="VcnCd" UniqueName="VcnCd"></telerik:GridBoundColumn>
      <telerik:GridBoundColumn HeaderText="VcnNm" DataField="VcnNm" UniqueName="VcnNm"></telerik:GridBoundColumn>
    </Columns>
    <EditFormSettings InsertCaption="Add record" CaptionDataField="VcnCd" CaptionFormatString="Edit record: {0}"
      EditFormType="Template" PopUpSettings-Modal="true" PopUpSettings-Height="260px" PopUpSettings-Width="500px">
      <FormTemplate>
        <table>
          <tr>
            <td>
              Code: <asp:DropDownList ID="dpdVcnCd" DataTextField="VcnNm" DataValueField="VcnCd" SelectedValue='<%# Bind("VcnCd") %>' 
              runat="server" DataSourceID="SqlDataSource1"></asp:DropDownList>
            </td>
          </tr>
          <tr>
            <td>
              <asp:Button ID="btnSubmitVcnCd" Text='<%# Iif(typeof Container is GridEditFormInsertItem, "Insert", "Update") %>'
                runat="server" CommandName='<%# Iif(TypeOf Container is GridEditFormInsertItem, "PerformInsert", "Update") %>'
                CommandArgument='<%# Eval("VcnCd") %>' />
              <asp:Button ID="btnCancelVcnCd" Text="Cancel" runat="server" CausesValidation="false" CommandName="Cancel" />
            </td>
          </tr>
        </table>
      </FormTemplate>
    </EditFormSettings>
    <DetailTables>
      <telerik:GridTableView Name="DetailTables" EditMode="PopUp" DataKeyNames="ID" DataSourceID="SqlDataSource3"
        Width="100%" runat="server" CommandItemDisplay="Top">
        <ParentTableRelation>
          <telerik:GridRelationFields DetailKeyField="VcnCd" MasterKeyField="VcnCd" />
        </ParentTableRelation>
        <Columns>
          <telerik:GridEditCommandColumn ButtonType="ImageButton" EditImageUrl="../images/Edit.gif" UniqueName="Edit"></telerik:GridEditCommandColumn>
          <telerik:GridBoundColumn HeaderText="ID" DataField="ID" UniqueName="ID"></telerik:GridBoundColumn>
          <telerik:GridBoundColumn HeaderText="VcnCd" DataField="VcnCd" UniqueName="VcnCd"></telerik:GridBoundColumn>
          <telerik:GridBoundColumn HeaderText="Date" DataField="VcntnDt" UniqueName="VcntnDt" DataFormatString="{0:d}"></telerik:GridBoundColumn>
        </Columns>
        <EditFormSettings InsertCaption="Edit Item" CaptionFormatString="Edit ID: {0}" CaptionDataField="ID" EditFormType="Template"
          PopUpSettings-Modal="true" PopUpSettings-Height="260px" PopUpSettings-Width="400px">
          <PopUpSettings Modal="true" />
          <EditColumn UniqueName="EditCommandColumn1" ButtonType="ImageButton" InsertImageUrl="../images/plus.gif" EditImageUrl="../images/Edit.gif"></EditColumn>
          <FormTemplate>
            <table id="tblEditVcnDte">
              <tr>
                <td colspan="2" align="left">Vaccination Type: <asp:Label ID="lblvType" Text='<%# Bind("VcnCd") %>' runat="server"></asp:Label></td>
              </tr>
              <tr>
                <td align="right">Date :</td>
                <td>
                  <asp:TextBox ID="txtVcnDte" runat="server" Text='<%# Bind("VcntnDt","{0:d}") %>'></asp:TextBox>
                </td>
              </tr>
            </table>
            <table style="width: 100%">
              <tr>
                <td align="right" colspan="2">
                  <asp:Button ID="btnSubmitVcn" Text='<%# Iif(typeof Container is GridEditFormInsertItem, "Insert", "Update") %>'
                    runat="server" CommandName='<%# Iif(TypeOf Container is GridEditFormInsertItem, "InsertCdDt", "UpdateCdDt") %>'
                    CommandArgument='<%# Eval("ID") %>'  />
                  <asp:Button ID="btnCancelVcn" Text="Cancel" runat="server" CausesValidation="false" CommandName="Cancel" />
                </td>
              </tr>
            </table>
          </FormTemplate>
        </EditFormSettings>
      </telerik:GridTableView>
    </DetailTables>
  </MasterTableView>
  <ClientSettings>
    <ClientEvents OnPopUpShowing="PopUpShowing" />
    <Selecting AllowRowSelect="true" />
  </ClientSettings>
 
</telerik:RadGrid>
mike
Top achievements
Rank 1
 answered on 12 Apr 2013
2 answers
639 views
Hello.

I'm using a GridImageColumn in a document management scenario to display a small thumbnail of the document being referred to by each row in my grid.  I create the image column in code-behind, because my grid column set is somewhat dynamic based on configuration of our product.  In the method that creates the GridImageColumn, I have the following code:

gridView.Columns.Add(imageColumn);
imageColumn.HeaderText = label;
imageColumn.ImageHeight = 30;
imageColumn.ImageWidth = 30;

When I use this, my images are sized to the exact size specified, where I had instead hoped that it would create a bounding box around the image and preserve the aspect ratio of the image.

Is there any straightforward way to preserve the aspect ratio?
David
Top achievements
Rank 1
 answered on 12 Apr 2013
1 answer
280 views
asp.net

So I have a Grid that users enter data in (no surpise there) and then they hit a submit button to submit the changes to the database.

In the ItemDataBound event I determine if the field is a text box, then determine if I should set it multi or single line (if it is under a certain number of characters, it will stay singline.)

Dim txt As TextBox = CType(e.Item.FindControl("txtValue"), TextBox)
txt.TextMode = TextBoxMode.MultiLine

I am trying to figure out how to do this same logic on the client side in javascript.

function processValueChange(sender, rowID) {
     var myTextValue = row.findElement("Value");
     myTextValue = Multiline;
}

I do not know if you can set the mode like this on the fly without rebinding the grid...

Also the reason I do not set the MultiLine always to true on textboxes is because of the scrollbar that shows up in the multiline text box.  It is very distracting to see a bunch of little arrows in all my text box fields and would like them visible only when necessary.  Unless there is a way to get ride of them.
Eyup
Telerik team
 answered on 12 Apr 2013
1 answer
195 views
Dear Telerik Team,

We are using Rad Multi page (Tab) control. if we want to Hide/Show Panel Control at client side. we could not do that since object itself not available. it is an content page with Rad Multi page. we tried with Div also. we could not hide / show that control on run time at client side. This behaviour works if its without rad multi page. 

if we hide the control by setting visible properties of Panel at design time. it is not rendered to client side at all. 
but for Div Tag if use Style display:None,it is rendering at client side but not hiding the div tag.

the above functionality works without rad multi page

Requesting your help on the same.


With Regadrs
Palanivelrajan



Nencho
Telerik team
 answered on 12 Apr 2013
1 answer
175 views
Hi
How can I give background image to my radbutton. Please help me out.

thank you
Allen
Princy
Top achievements
Rank 2
 answered on 12 Apr 2013
1 answer
117 views

Hello,

Have custom EditFormSettings with a delete button that is wired to a postback event handler.

<EditFormSettings>
...
<FormTemplate>
...

<telerik:RadButton ID="btnDelete" Text="Delete" Visible='<%# (Container is GridEditFormInsertItem) ? false : true %>' runat="server" CausesValidation="false" Icon-PrimaryIconCssClass="rbRemove" Icon-PrimaryIconLeft="4" Icon-PrimaryIconTop="4" onclick="btnDelete_Click"/>


</FormTemplate>
</EditFormSettings>
<LinqDataSource ...

code

 

dataContext.TableName.DeleteOnSubmit(item);

 

sdb.SubmitChanges();

rgFormEmail.DataBind()

Grid is shown and edit button is hidden. Code below resolves but why would the edit column be hidden?

rgFormEmail.MasterTableView.GetColumn("BtnEdit").Visible = true;

 

 

Kostadin
Telerik team
 answered on 12 Apr 2013
3 answers
316 views
Hi
     How to change the selection color of items in combobox inside itemtemplate of radgrid. Please suggest a solution
thanks
Savyo
Princy
Top achievements
Rank 2
 answered on 12 Apr 2013
5 answers
68 views
hi Telerik team ..

i created a simple raddatepicker , but i can't select Sunday:31 march 2013,
Can anyone help me how can i choose this day 

(this problem appears on Chrome and opera , it works correctly on IE)
Eyup
Telerik team
 answered on 12 Apr 2013
3 answers
111 views
Hi,

I'm trying to create dynamic controls within and EditForm of the RadGrid. I've read from previous posts that I need to do this within ItemCreated. The problem I have is that I need to create the dynamic controls based on what the user selects in a DropDownList as shown here

<EditFormSettings EditFormType="Template">
    <FormTemplate>
        <asp:DropDownList ID="AreaOfPracticeSelect" runat="server" AutoPostBack="true" DataSourceID="AreaOfPracticeDataSource" DataTextField="mps_name" DataValueField="mps_areaofpractice_lookupid" AppendDataBoundItems="true">
            <asp:ListItem Value="" Text="" />
        </asp:DropDownList>
        <h5>Criteria</h5>
        <asp:PlaceHolder ID="CriteriaPlaceHolder" runat="server" />
    </FormTemplate>
</EditFormSettings>

protected void AreaOfPracticeGrid_ItemCreated(object sender, GridItemEventArgs e)
{
    if (e.Item is GridEditableItem && e.Item.IsInEditMode)
    {
        DropDownList areaOfPracticeSelect = e.Item.FindControl("AreaOfPracticeSelect") as DropDownList;
 
        if (areaOfPracticeSelect != null && !string.IsNullOrEmpty(areaOfPracticeSelect.SelectedValue))
        {
            Guid areaOfPracticeId = new Guid(areaOfPracticeSelect.SelectedValue);
 
            LoadCriteria(e.Item as GridEditFormItem, areaOfPracticeId);
        }
    }
}

The problem is that AreaOfPracticeSelect DropDown is always empty, any ideas how I can accomplish this?
David Rhodes
Top achievements
Rank 1
 answered on 12 Apr 2013
1 answer
623 views
I have a radmenu control with menus such as "Skin", "Links" etc. Skin menu having child items such as "Forest", "Black", "Default" etc.
If I selected Forest, I'm getting it from radmenu1_itemClick event using the code - "e.Item.Text". But in my case, if I select Forest, I need to check some condition using it's parent (here "Skin") text from the code.
Boyan Dimitrov
Telerik team
 answered on 12 Apr 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?