Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
250 views
I have searched and searched and all available solutions are not working for me.

I have a RadGrid that I am databinding at runtime. Each time I select a row, it will fire the SelectedIndexChanged, but I get an index error or the value selected is nothing. I'm at my wits end here and I'm not sure how to proceed.

Here's my aspx page:

                <asp:Panel runat="server" ID="DrugList" Height="370px" Width="550" ScrollBars="Auto"
 
<telerik:RadGrid ID="rgDrugList" runat="server" AllowMultiRowSelection="True" 
                    AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" GridLines="None" 
                    Height="350px" OnItemCommand="rgDrugList_ItemCommand" 
                    Skin="Vista" Width="545px" OnselectedIndexChanged="rgDrugList_SelectedIndexChanged"
                    <MasterTableView> 
                        <PagerStyle Mode="NextPrevAndNumeric" /> 
                        <Columns> 
                            <telerik:GridBoundColumn DataField="Name" HeaderText="Drug Name" SortExpression="Name" UniqueName="Name"
                            </telerik:GridBoundColumn> 
                        </Columns> 
                    </MasterTableView> 
                    <ClientSettings EnablePostBackOnRowClick="true"
                        <Selecting AllowRowSelect="True" /> 
                    </ClientSettings> 
                </telerik:RadGrid> 
                 
                </asp:Panel> 

And here's my vb code:

    Protected Sub form1_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles form1.Load 
        InitializeData() 
    End Sub 
 
    Protected Sub InitializeData() 
        Dim o As New localhost.Service1 
        Dim ds As New DataSet 
 
        ds = o.GetNumbderDrugData 
 
        If ds Is Nothing Then 
            errorPanel.Visible = True 
            Exit Sub 
        End If 
 
        If ds.Tables(0).Rows.Count = 0 Then 
            errorPanel.Visible = True 
            Exit Sub 
        Else 
            errorPanel.Visible = False 
            rgDrugList.DataSource = ds 
            rgDrugList.DataBind() 
          
        End If 
    End Sub     
 
 
Protected Sub rgDrugList_SelectedIndexChanged(ByVal sender As ObjectByVal e As System.EventArgs) Handles rgDrugList.SelectedIndexChanged 
        Dim item As GridDataItem = DirectCast(rgDrugList.SelectedItems(0), GridDataItem) 
        ' Get the first selected item 
        If True Then 
            MsgBox(item("Name").Text) 
        End If 
    End Sub 

I have tried using a button as well to fire the event. This doesn't seem to be the issue, as the event fires, I just can't get the value selected. Any help here would be greatly appreciated.





Daniel
Telerik team
 answered on 24 Apr 2009
1 answer
61 views
How do you make multiple selection from the RadScheduler in the Month view mode.

I would like to select for example a Monday and all the Mondays within the Month would book an appointment or be highlighted.

 

 


 

 

Atanas Korchev
Telerik team
 answered on 24 Apr 2009
3 answers
102 views
The only way I've found of controlling the placement of controls on a Web Form is to create a table and place the controls within the cells of the table.  In other environments it is possible to simply move the control onto a form and it stays in the position it was placed.  Is there a way to do this with Ajax Web Forms?  I saw a video that showed use of the layout menu option in Visual Studio but I haven't seen that menu option for the Ajax Web Form.

Thanks,
William Corry
Top achievements
Rank 1
 answered on 24 Apr 2009
5 answers
197 views
Hi,

I have two checkboxes and query will build dyanamically which checkbox is checked.

Here is the code


 

private DataTable GetData(string text)

 

{

objUser = (

LoggedUser)Session["USER"];

 

 

string appendSql = string.Empty;

 

objUser = (

LoggedUser)Session["USER"];

 

 

string appendText = string.Empty;

 

 

string appText = string.Empty;

 

 

string fillMedication = string.Empty;

 

 

int catType = 0;

 

 

if (RbtnOral.Checked == true)

 

{

catType =

TypeID.ORAL_TYPE;

 

}

 

else

 

{

catType =

TypeID.TOPICAL_TYPE;

 

}

 

if (text != "")

 

{

appendText =

" AND LD.DRUG_NAME LIKE '" + text + '%' + "' ";

 

appText =

"AND LPM.DRUG_NAME LIKE '" + text + '%' + "' ";

 

}

 

if (chkStandard.Checked == true)

 

{

fillMedication =

"SELECT TOP 10 LD.DRUG_NAME AS MEDICATION, PK_DRUG_ID AS PKMEDICATION FROM L_DRUGNAME LD " +

 

 

"WHERE " +

 

 

" LD.DRUG_NAME IS NOT NULL " + appendText + " ";

 

}

 

else

 

{

fillMedication =

"SELECT LD.DRUG_NAME as MEDICATION,PK_ID as " +

 

 

"PKMEDICATION,case LPM.STRENGTH when ' ' then ' ' " +

 

 

"else isnull((select strength from l_strength where " +

 

 

"CONVERT(VARCHAR,pk_stren_id)=LPM.STRENGTH),' ') " +

 

 

"end as STRENGTH,PK_ID as PKSTRENGTH,case LPM.DIRECTIONS when ' ' then ' ' " +

 

 

"else isnull((select DIRECTIONS from L_DIRECTIONS where " +

 

 

"Convert(varchar,PK_DIR_ID)=LPM.DIRECTIONS),' ') " +

 

 

"end as DIRECTIONS,PK_ID as " +

 

 

"PKDIRECTIONS from L_PREFERED_MEDICATION LPM,L_DRUGNAME LD where " +

 

 

"CONVERT(VARCHAR,pk_drug_id)=LPM.DRUG_NAME " + appendText + " " +

 

 

"and LPM.DRUG_NAME IS NOT NULL " +

 

 

" AND LPM.FK_PRACTIONER_ID = " + objUser.PractitionerID + " AND LPM.STATUS = 1 AND IS_CUSTOM = 'FALSE' AND LPM.Category =" + catType + " " +

 

 

"UNION " +

 

 

"SELECT DRUG_NAME AS MEDICATION, LPM.PK_ID,LPM.STRENGTH AS STRENGTHSTR, " +

 

 

"LPM.PK_ID AS PKSTRENGTH,LPM.DIRECTIONS AS 'DIRECTIONSSTR',LPM.PK_ID AS 'PKDIRECTIONS' " +

 

 

"FROM L_PREFERED_MEDICATION LPM WHERE LPM.FK_PRACTIONER_ID = " + objUser.PractitionerID + " " +

 

 

"AND LPM.STATUS = 1 AND IS_CUSTOM = 'TRUE' " + appText + " and DRUG_NAME IS NOT NULL AND LPM.Category =" + catType +" ";

 

 

}

 

DataTable dtData = SqlHelper.ExecuteDataset(new Connection().GetCon, CommandType.Text, fillMedication).Tables[0];

 

 

return dtData;

 

}



protected

 

void RadComboBoxMedication_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)

 

{

 

DataTable data = GetData(e.Text);

 

RadComboBoxMedication.Items.Clear();

 

string text = e.Text;

 

 

DataRow[] rows = data.Select();

 

 

int itemsPerRequest = 10;

 

 

int itemOffset = e.NumberOfItems;

 

 

int endOffset = itemOffset + itemsPerRequest;

 

 

if (endOffset > rows.Length)

 

{

endOffset = rows.Length;

}

 

for (int i = itemOffset; i < endOffset; i++)

 

{

RadComboBoxMedication.Items.Add(

new RadComboBoxItem(data.Rows[i]["MEDICATION"].ToString(), data.Rows[i]["PKMEDICATION"].ToString()));

 

}

 

// e.Message = String.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffset, rows.Length);

 

e.Message = GetStatusMessage(endOffset, data.Rows.Count);

}


even after i uncheck chkStandard checkbox or rbtnOral radioButton but it shows it is checked.


Plz help me.

Simon
Telerik team
 answered on 24 Apr 2009
4 answers
182 views
Is there a way to set focus away from a combobox after a user selects an item? I want the ComboBox to lose focus immediately after the user makes a selection.


ManniAT
Top achievements
Rank 2
 answered on 24 Apr 2009
5 answers
149 views
Hello,

I have enabled a general confirm using radwindows radconfirm but I am unable to have it working with OnClientCommand.
Any idea how to do this ?

Thanks
CS
Tervel
Telerik team
 answered on 24 Apr 2009
3 answers
160 views
I found a couple of posts on this subject but no actual step by step instructions. Can someone tell me exactly how to achieve round corners on the rad docks? I know you have to change the background color to match the web site in some CSS file somewhere but I cannot find it.

Thanks!
Sam
ManniAT
Top achievements
Rank 2
 answered on 24 Apr 2009
1 answer
120 views
Is it easy to integrate the RadProgressArea and RadProgressManager features into the File Explorer control? I looked around the demos and manual but I don't see any mention of this. I tested uploading a 1 GB file and only the MSIE progress indicator let me know it was transferring data.
Tervel
Telerik team
 answered on 24 Apr 2009
1 answer
353 views
Hi,

I am dynamically generating the radgrid at runtime (coz number of columsn will be known only at runtime). I am adding a GridButtonColumn for each column as below (where * is the GridButtonColumn..which will be an ImageButton, ValueA1, ValueB1, etc are Textbox in ItemTemplate)

Name                                        A                                            B

Test1                                    valueA1    *                               valueB1    *
Test2                                    valueA2     *                               valueB2   *
Test3                                    valueA3     *                               valueB3   *
                    Bulk Update      Textbox1  *                               Textbox2 *

The code for it is as below,

btnColOk = new GridButtonColumn();

 

btnColOk.ButtonType =

GridButtonColumnType.ImageButton;

 

rgTest.MasterTableView.Columns.Add(btnColOk);

btnColOk.ImageUrl =

@"~\Images\tick.png";

 

btnColOk.CommandName =

"btnColOk_Click";

Now in the ItemCommand Event, the code is as below,

 

protected

void rgTest_ItemCommand(object source, GridCommandEventArgs e)

 

{

 

if (e.CommandName == "btnColOk_Click")

 

{

 

GridDataItem dataItem = (GridDataItem)e.Item;

 

 

ImageButton btn1 = (ImageButton)dataItem["btnColOk"].Controls[0];

 

btn1.Click +=

new ImageClickEventHandler(btn1_Click);

 

}

}

Now when i click on any ImageButtons, am getting an error as
"An error has occurred because a control with id 'rgTest$ctl00$ctl04$ctl00' could not be located or a different control is assigned to the same ID after postback. If the ID is not assigned, explicitly set the ID property of controls that raise postback events to avoid this error. "

But am not able to specify an id for 'btnColOk' GridButtonColumn.
Can anyone please help me in this?

Thanks

Sujith

Sebastian
Telerik team
 answered on 24 Apr 2009
7 answers
582 views
I finally got the latest version of the RadControls integrated into the default MVC application that VS 2008 creates in order to see how it all works. The issue I am having is that I am doing field validation in the controller (i.e., required field, etc) and want to display the field in red (default MVC css style called input-validation-error). This is the default MVC validation summary css style. I am using the Web20 skin as my default. I thought setting the invalidstyle Css class would do it but no luck. Can I override this somehow? I must be missing something obvious.

TIA, Tom
Dimo
Telerik team
 answered on 24 Apr 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?