Reputation: 5098
Followed this example on telerik's website and implemented as follows:-
aspx page:-
<div id="div1" runat="server">
<telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="RadMultiPage1">
</telerik:RadTabStrip>
<telerik:RadMultiPage ID="RadMultiPage1" runat="server" Width="100%">
<telerik:RadPageView ID="pv1" runat="server" Selected="true">
</telerik:RadPageView>
</telerik:RadMultiPage>
</div>
code behind:-
This method in the line dataset ds = objbllQuesType.GetQuesType(); returns a DataSet with a table containing QuesTypeID and QuesType's Name
Now what is happening is, only 4 Tabs are being generated on the RadStrip which I know is coz of the "for loop (int i = 0; i < 4; i++)" I want the no. of tabs to be equal to the no. of QuesType s I have in my Table which is 6.
Also , ALL the tabs' Text is "QuesType1" when it should be as follows:-
In the RadStrip, Tab1's Text should be "QuesType1", Tab2's Text should be "QuesType2" , Tab3's Text should be "QuesType3" and so on.
How should I modify the code above to achieve what I want ?
[EDIT] Has anyone worked with Telerik's RADStrip? Need help plz.
What should I change in the code below so it fetches the QuesTypes and binds QuesTypes to the tabs ? Currently its only fetching 1st QuesType and binding that one to ALL the tab's text attribute.
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
tab.Text = ds.Tables[0].Rows[0]["QuesType"].ToString();
}
Upvotes: 0
Views: 853
Reputation: 905
Try this code for set text to tabs:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
DataSet ds = GetDataSet();
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
CreateRootTab(i, ds);
}
RadTabStrip1.SelectedIndex = 0;
}
}
private void CreateRootTab(int index, DataSet ds)
{
for (int i = 0; i < ds.Tables[0].Columns.Count; i++)
{
var tab = new RadTab();
tab.Text = (string) ds.Tables[0].Rows[index].ItemArray[i];
RadTabStrip1.Tabs.Add(tab);
}
}
private DataSet GetDataSet()
{
bllQuesType objbllQuesQType = new bllQuesType();
var ds = new DataSet();
return objbllQuesType.GetQuesType();
}
I didn't work with Rad, but I think it can be helpfull in your case.
Best regards, Dima.
Upvotes: 1