Hi Guys,
Im busy creating a betting application using C# asp.net.
Pretty much what happens is, at betting sites cashiers will log onto the website and may generate a voucher which is printed and given to customers.
I am using a masterPage, the RadScriptManager and AjaxManager are found on the master page.
My Sales.aspx page which has a RadAjaxPanel which holds a RadMultiPage control that has 2 tabs (scratchcards and vouchers).
My Voucher Tab has a Button (Generate) which will randomly generate a voucher PIN and is supposed to open a rad window after all the code has been executed which it fails to do.
Just as a Test i dropped a button on the page (Outside of the Panel) and was able to successfully open the rad window with that button, but the RadWindow does not open if i try open it from the Generate Button held inside of the MultiPageView Control.
Any Ideas Why?
aspx code for my Panel
C# code for the Generate Button inside the PageView control
Code i am using to open the RadWindow on the button outside of the PageView (This code works only if it is not inside of the PageView)
Thanx in advance
Im busy creating a betting application using C# asp.net.
Pretty much what happens is, at betting sites cashiers will log onto the website and may generate a voucher which is printed and given to customers.
I am using a masterPage, the RadScriptManager and AjaxManager are found on the master page.
My Sales.aspx page which has a RadAjaxPanel which holds a RadMultiPage control that has 2 tabs (scratchcards and vouchers).
My Voucher Tab has a Button (Generate) which will randomly generate a voucher PIN and is supposed to open a rad window after all the code has been executed which it fails to do.
Just as a Test i dropped a button on the page (Outside of the Panel) and was able to successfully open the rad window with that button, but the RadWindow does not open if i try open it from the Generate Button held inside of the MultiPageView Control.
Any Ideas Why?
aspx code for my Panel
<
telerik:RadAjaxPanel
ID
=
"RadAjaxPanel1"
runat
=
"server"
BorderColor
=
"Gray"
>
<
telerik:RadTabStrip
runat
=
"server"
ID
=
"RadTabStrip1"
SelectedIndex
=
"0"
MultiPageID
=
"RadMultiPage1"
CssClass
=
"HeaderClass"
Skin
=
"Glow"
BackColor
=
"#DDDDDD"
>
<
Tabs
>
<
telerik:RadTab
Text
=
"Scratchcards"
SelectedIndex
=
"0"
>
</
telerik:RadTab
>
<
telerik:RadTab
Text
=
"Vouchers"
>
</
telerik:RadTab
>
</
Tabs
>
</
telerik:RadTabStrip
>
<
telerik:RadMultiPage
runat
=
"server"
ID
=
"RadMultiPage1"
SelectedIndex
=
"0"
Width
=
"400px"
CssClass
=
"multiPage"
>
<
telerik:RadPageView
runat
=
"server"
ID
=
"RadPageView1"
>
<
div
class
=
"CenterDiv"
>
<
table
style
=
"width:400px;margin-left:25px;"
>
<
tr
>
<
td
>
<
asp:Label
ID
=
"Account"
runat
=
"server"
ForeColor
=
"#444444"
Text
=
"Product"
></
asp:Label
>
</
td
>
<
td
>
<
telerik:RadComboBox
ID
=
"cboProducts"
runat
=
"server"
Width
=
"100%"
></
telerik:RadComboBox
>
</
td
>
</
tr
>
<
tr
>
<
td
>
<
asp:Label
ID
=
"lblSerial"
runat
=
"server"
ForeColor
=
"#444444"
Text
=
"Serial Number"
></
asp:Label
>
</
td
>
<
td
>
<
telerik:RadMaskedTextBox
ID
=
"tbSerial"
runat
=
"server"
AutoCompleteType
=
"Disabled"
CssClass
=
"txtBox"
DisplayPromptChar
=
" "
Mask
=
"#########"
MaxLength
=
"9"
oncopy
=
"return false"
oncut
=
"return false"
onpaste
=
"return false"
PromptChar
=
" "
>
</
telerik:RadMaskedTextBox
>
</
td
>
</
tr
>
</
table
>
<
br
/>
<
table
style
=
"width:400px;margin-left:25px;"
>
<
tr
>
<
td
colspan
=
"3"
>
<
asp:Label
ID
=
"lblInfo"
runat
=
"server"
Font-Bold
=
"true"
Font-Size
=
"14px"
Text
=
""
></
asp:Label
>
<
br
/>
</
td
>
</
tr
>
</
table
>
<
div
class
=
"scratchcardSave"
>
<
br
/>
<
asp:Button
ID
=
"btnCheck"
runat
=
"server"
onclick
=
"btnCheck_Click"
Text
=
"Activate"
/>
<
asp:Button
ID
=
"btnClear"
runat
=
"server"
onclick
=
"btnClear_Click"
Text
=
"Clear"
/>
<
asp:Button
ID
=
"btnNewScratchcard"
runat
=
"server"
onclick
=
"btnNewScratchcard_Click"
Text
=
"Sell Another"
/>
</
div
>
</
div
>
</
telerik:RadPageView
>
<
telerik:RadPageView
runat
=
"server"
ID
=
"RadPageView2"
>
<
div
class
=
"CenterDiv"
>
<
table
style
=
"width:400px;margin-left:25px;"
>
<
tr
>
<
td
>
<
asp:Label
ID
=
"Label1"
runat
=
"server"
ForeColor
=
"#444444"
Text
=
"Product"
></
asp:Label
>
</
td
>
<
td
>
<
telerik:RadComboBox
ID
=
"cboProductType"
runat
=
"server"
Width
=
"100%"
></
telerik:RadComboBox
>
</
td
>
</
tr
>
<
tr
>
<
td
>
<
asp:Label
ID
=
"lblVoucherAmount"
runat
=
"server"
ForeColor
=
"#444444"
Text
=
"Amount"
></
asp:Label
>
</
td
>
<
td
>
<
telerik:RadMaskedTextBox
ID
=
"tbGeneratePIN"
runat
=
"server"
AutoCompleteType
=
"Disabled"
CssClass
=
"txtBox"
DisplayPromptChar
=
" "
Mask
=
"#########"
MaxLength
=
"9"
oncopy
=
"return false"
oncut
=
"return false"
onpaste
=
"return false"
PromptChar
=
" "
>
</
telerik:RadMaskedTextBox
>
</
td
>
</
tr
>
</
table
>
<
br
/>
<
table
style
=
"width:400px;margin-left:25px;"
>
<
tr
>
<
td
colspan
=
"3"
>
<
asp:Label
ID
=
"lblVoucherPIN"
runat
=
"server"
Font-Bold
=
"True"
Font-Size
=
"14px"
></
asp:Label
>
<
br
/>
</
td
>
</
tr
>
</
table
>
<
div
class
=
"scratchcardSave"
>
<
br
/>
<
asp:Button
ID
=
"btnVoucherGenerate"
runat
=
"server"
onclick
=
"btnVoucherGenerate_Click"
Text
=
"Generate"
/>
<
asp:Button
ID
=
"btnVoucherClear"
runat
=
"server"
onclick
=
"btnVoucherClear_Click"
Text
=
"Clear"
/>
</
div
>
</
div
>
</
telerik:RadPageView
>
</
telerik:RadMultiPage
>
</
telerik:RadAjaxPanel
>
C# code for the Generate Button inside the PageView control
protected
void
btnVoucherGenerate_Click(
object
sender, EventArgs e)
{
if
(tbGeneratePIN.Text ==
string
.Empty)
{
lblVoucherPIN.ForeColor = System.Drawing.Color.Red;
lblVoucherPIN.Text =
"Please insert voucher amount"
;
}
else
{
iThNkContext.Prepaid pre =
new
iThNkContext.Prepaid();
String newID =
""
;
newID = Guid.NewGuid().ToString().Replace(
"-"
,
""
);
newID = newID.Substring(newID.Length - 16);
newID = newID.ToUpper();
// Add PIN to Prepaid DB
var userInfo = (from c
in
db.Currencies
from a
in
db.Accounts
from s
in
db.Sites
from u
in
db.Users
where c.CurrencyID == a.CurrencyID &&
a.AccountID == u.AccountID &&
s.SiteID == u.SiteID &&
u.UserID == LoggedUserID)
select
new
{
AccountID = a.AccountID,
CurrencyID = c.CurrencyID,
CurrencySymbol = c.CurrencySymbol,
SiteName = s.SiteName,
AccountName = a.AccountName
}).FirstOrDefault();
if
(userInfo !=
null
)
{
AccountID = userInfo.AccountID;
CurrencyID = userInfo.CurrencyID;
CurrencySymbol = userInfo.CurrencySymbol;
}
try
{
pre.CurrencyID = CurrencyID;
pre.AccountID = AccountID;
pre.Amount = Convert.ToDecimal(tbGeneratePIN.Text);
pre.SerialNumber = (
"_"
);
pre.Pin = newID;
pre.TransactionTypeID = 2;
pre.SalesUserID = LoggedUserID);
pre.SalesDate = DateTime.Now;
pre.IsActivated =
true
;
pre.IsActive =
true
;
db.Prepaids.InsertOnSubmit(pre);
db.SubmitChanges();
pre.SerialNumber = Convert.ToString(pre.PrepaidID).PadLeft(9,
'0'
);
db.SubmitChanges();
Amount = pre.Amount;
SerialNumber = pre.SerialNumber;
PinNumber = pre.Pin;
SiteName = userInfo.SiteName;
accountID = userInfo.AccountID;
AccountName = userInfo.AccountName;
// update the database and set isPrinted = 1
pre.IsPrinted =
true
;
db.SubmitChanges();
tbGeneratePIN.Text =
string
.Empty;
RadWindow newWindow =
new
RadWindow();
newWindow.NavigateUrl =
"Vouchers.aspx"
;
newWindow.Top = Unit.Pixel(22);
newWindow.VisibleOnPageLoad =
true
;
newWindow.Left = Unit.Pixel(0);
RadWindowManager1.Windows.Add(newWindow);
}
catch
(Exception ex)
{
lblVoucherPIN.ForeColor = System.Drawing.Color.Red;
lblVoucherPIN.Text = ex.Message;
}
}
}
Code i am using to open the RadWindow on the button outside of the PageView (This code works only if it is not inside of the PageView)
protected
void
RadButton1_Click(
object
sender, EventArgs e)
{
RadWindow newWindow =
new
RadWindow();
newWindow.NavigateUrl =
"http://www.google.com"
;
newWindow.Top = Unit.Pixel(22);
newWindow.VisibleOnPageLoad =
true
;
newWindow.Left = Unit.Pixel(0);
RadWindowManager1.Windows.Add(newWindow);
}
Thanx in advance